#18012: Propagate reverse foreign keys from proxy models to base class
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: charettes
Type: | Status: assigned
Cleanup/optimization |
Component: Database layer | Version: 1.4
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by carljm):
Replying to [comment:16 akaariai]:
> What I'm after is that if we add proxy relations to the parent models we
don't break anything (except for backwards incompatibility in the Meta
API). The same isn't true for MTI inheritance, where a lot would break if
we added child model relations to parent models.
Yep, agreed. That's why, as I said above, I'm not strongly opposed to this
ticket; -0 at worst. Just don't think there's much wrong with the status
quo either.
> We do support an inheritance chain of Concrete -> ProxyConcrete ->
ProxyConcreteChild. Interestingly this chain actually creates a foreign
key from ProxyConcreteChild directly to Concrete in the model definition.
This is inconsistent, the foreign key should be to ProxyConcrete. But we
can't do that, as then
Concrete.objects.select_related('proxyconcretechild') wouldn't work, as
Concrete doesn't have the reverse descriptor for the relation from
ProxyConcreteChild to ProxyConcrete.
Yeah, that is slightly odd. But given that the FK (OneToOne, really,
right?) in this case is an internal implementation detail that the user
isn't likely to ever need to follow directly, it doesn't seem like much of
a problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/18012#comment:17>
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/066.f76916f2f87e6f2542e67a12f5bda577%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.