Proxy model ContentType question

98 переглядів
Перейти до першого непрочитаного повідомлення

Ryan

не прочитано,
17 лют. 2010 р., 03:05:3117.02.10
Кому: Django users
In django/contrib/contenttypes/models.py (get_for_model), I noticed
that for a proxy model object, the contenttype being returned is of
the base concrete class since it sets opts to the _meta of
proxy_for_model . If one uses a generic relation in the admin app,
you can set the generic contenttype to that of a proxy model class. I
was just wondering if the contenttype get_for_model call is returning
the correct type (concrete base class)?

Ryan

не прочитано,
19 лют. 2010 р., 20:36:3319.02.10
Кому: Django users
As an update:

Since you can actually assign a generic relation in the admin app to a
proxy model object, when using a generic relation, the proxy objects
aren't returned because the lookup is using get_for_model which
returns an instance of the base class. (I only figured this out after
having wrapped the ContentType get_by_natural_key call). I'm
wondering what other implications there are if I continue to use the
get_by_natural_key as a way to get the proxy content type.


On Feb 16, 10:05 pm, Ryan <ryanka...@gmail.com> wrote:
> In django/contrib/contenttypes/models.py (get_for_model), I noticed

> that for a proxy model object, thecontenttypebeing returned is of


> the base concrete class since it sets opts to the _meta of
> proxy_for_model .  If one uses a generic relation in the admin app,

> you can set the genericcontenttypeto that of a proxy model class.  I
> was just wondering if thecontenttypeget_for_model call is returning

Відповісти всім
Відповісти автору
Переслати
0 нових повідомлень