#30531: Exception when creating an inherited model object with existing base
-------------------------------------+-------------------------------------
Reporter: Victor Porton | Owner: nobody
Type: Bug | Status: closed
Component: Database layer | Version: 2.2
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* status: new => closed
* resolution: => invalid
Comment:
If you want to use `Derived.base` as your inheritance parent link you have
to
[https://docs.djangoproject.com/en/2.2/ref/models/fields/#django.db.models.OneToOneField.parent_link
mark it accordingly].
Right now your table `Derived` model has two o2o fields pointing at
`Base`; the explicit one you defined and the implicit parent link
`base_ptr`. When you try to create your `Derived` object in `test_bug`
it's the `base_ptr.v` field value that is missing.
Adding `parent_link=True` to your `Derived.base` field should address your
issue.
Closing per TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/30531#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.52cd6760464e84926a1c4f119ccd4362%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.