#17678: Model._meta proxy_for_model set up incorrectly
----------------------------------------------+--------------------
Reporter: akaariai | Owner: nobody
Type: Bug | Status: new
Component: Database layer (models, ORM) | Version: 1.3
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------------------+--------------------
There are some places in the code which assume that proxy_for_model
creates a proxy chain. That is, if you have models:
{{{
A
Proxy(A)
ProxyProxy(Proxy)
}}}
the expected result is that ProxyProxy._meta.proxy_for_model == Proxy, but
this isn't true. One place which makes this proxy-chain mistake is the
very place that sets up the proxy_for_model so this seems like a clear
bug.
In the attached patch I added ._meta.concrete_class, which is always the
concrete class of the model. This simplifies code in some places. In
addition, the proxy_for_model correctly creates a proxy chain now.
I think the proxy_for_model error was responsible for one bug in admin,
but I haven't verified that there was a bug (so, no tests). In addition
there is one place in sql/query.py which is working now as it was before,
but I am not sure if the before behavior was in fact correct. Neither of
these should be this ticket's problems.
The bug is present in at least 1.3, maybe even before.
--
Ticket URL: <https://code.djangoproject.com/ticket/17678>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.