diff options
author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-04-11 13:22:32 +0000 |
---|---|---|
committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2009-04-11 13:22:32 +0000 |
commit | 92824e71028d40009d32fc68d459b0c2242fb7fe (patch) | |
tree | 4dda465a583d35a8d1e9483b13b6f334ef78a8c1 /tests/modeltests | |
parent | e12e0e18a4a666c22e119990a495c76079110934 (diff) | |
download | django-92824e71028d40009d32fc68d459b0c2242fb7fe.tar.gz |
Fixed #10738 -- Fixed content type values for deferred and proxy models.
Models with deferred fields, or which are proxying for an existing
model, now return the same ContentType object as the real model they
reflect. Thanks to tomasz.elendt for help with fixing this.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10523 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests')
-rw-r--r-- | tests/modeltests/proxy_models/models.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/modeltests/proxy_models/models.py b/tests/modeltests/proxy_models/models.py index 275b5207cc..ab381129cf 100644 --- a/tests/modeltests/proxy_models/models.py +++ b/tests/modeltests/proxy_models/models.py @@ -5,6 +5,7 @@ than using a new table of their own. This allows them to act as simple proxies, providing a modified interface to the data from the base class. """ +from django.contrib.contenttypes.models import ContentType from django.db import models @@ -171,6 +172,12 @@ FieldError: Proxy model 'NoNewFields' contains model fields. [<OtherPerson: barney>, <OtherPerson: fred>] >>> OtherPerson._default_manager.all() [<OtherPerson: barney>, <OtherPerson: wilma>] + +# A proxy has the same content type as the model it is proxying for (at the +# storage level, it is meant to be essentially indistinguishable). +>>> ctype = ContentType.objects.get_for_model +>>> ctype(Person) is ctype(OtherPerson) +True """} |