#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 timgraham):
I think Anssi's point about "if there was an easy way to achieve retrieval
as proxy, then the whole FK to proxy could be deprecated (unless I am
missing some other important use case)" is an interesting one. Maybe this
could be achieved if proxy models added an `as_<proxy_name>()` method to
the proxied class. For example, instead of `B` defining the foreign key to
`ProxyA`, it would defined a foreign key to `A` and if you want to access
`ProxyA` instead:
{{{
>>> b = B.objects.get()
>>> b.a.as_proxya()
<ProxyA>
}}}
I'm not a big user of proxy models so there could very well be problems
with this approach, but I think we should be sure to thoroughly reject
that option before continuing down the road of enhanced support for
relationships to proxy models.
A related issue is "#10961 - Allow users to override forward and reverse
relationships on proxy models with ForeignKey fields".
--
Ticket URL: <https://code.djangoproject.com/ticket/18012#comment:10>
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.ffa60910f73023c974b55c068053d8ce%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.