Skip to content
/ django Public

Fixed #29871 -- Allowed setting pk=None on a child model to create a copy.#12273

Merged
felixxm merged 1 commit intodjango:masterfrom
ChetanKhanna:fix_29871
Jan 15, 2020
Merged

Fixed #29871 -- Allowed setting pk=None on a child model to create a copy.#12273
felixxm merged 1 commit intodjango:masterfrom
ChetanKhanna:fix_29871

Conversation

@ChetanKhanna
Copy link
Contributor

@ChetanKhanna ChetanKhanna commented Jan 3, 2020

Ensured that setting pk = None sets all parent_ptr_id's as well as
all AutoField's in the parent heirarchy to None. This follows the
current documentation on copying model instances:
https://docs.djangoproject.com/en/3.0/topics/db/queries/#copying-model-instances
Thanks Simon for the initial patches on Trac!

@ChetanKhanna
Copy link
Contributor Author

I forgot to thank Tim for his work!
#10549

Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChetanKhanna Thanks for this patch 👍 I left comments.

@felixxm felixxm changed the title Fixed #29871 -- saving new instance on setting pk = None Fixed #29871 -- Allowed setting pk=None on a child model to create a copy. Jan 13, 2020
@felixxm felixxm requested a review from charettes January 14, 2020 07:23
@felixxm
Copy link
Member

felixxm commented Jan 14, 2020

I added test without multi-models inheritance.

@felixxm felixxm force-pushed the fix_29871 branch 2 times, most recently from a1b9bdf to 4fa96fe Compare January 14, 2020 13:02
@felixxm
Copy link
Member

felixxm commented Jan 14, 2020

@ChetanKhanna Thanks for this patch 👍 Welcome aboard ⛵

@charettes Thanks for the review and initial patch 🌟

…copy.

Thanks Simon Charette and Tim Graham for the initial patch.
@felixxm felixxm merged commit 63e6ee1 into django:master Jan 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants