#10811: Assigning unsaved model to a ForeignKey leads to silent failures
-------------------------------------+-------------------------------------
Reporter: Glenn | Owner:
Type: Bug | anubhav9042
Component: Database layer | Status: assigned
(models, ORM) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by anubhav9042):
I have found out some things regarding the failure of tests, and it is due
to inherited models.
In case of `admin_inline` test(look into
https://github.com/django/django/blob/master/tests/admin_inlines/tests.py#L191):
the Extraterrestrial object is never assigned a `pk`, this failure of
tests is not due to the fix of #10811 but there is some other problem
because a similar test(see
https://github.com/django/django/blob/master/tests/admin_inlines/tests.py#L65)
works fine.
If you look at models, there is:
{{{
class Lifeform():
pass
class ExtraTe...(Lifeform):
pass
class Sighting():
some_fk = ExtraTerr...
}}}
In database instead of `id` in ExtraTerrestrial there is a field
`lifeform_ptr_id`, which never gets a value. I have tried out printing out
`id` of the ET object before and after save is called but it comes out
`None`. So the problem lies there.
--
Ticket URL: <https://code.djangoproject.com/ticket/10811#comment:27>
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/063.70c42c156cee729c8506c4a3d6285ee4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.