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/regressiontests | |
| parent | e12e0e18a4a666c22e119990a495c76079110934 (diff) | |
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/regressiontests')
| -rw-r--r-- | tests/regressiontests/defer_regress/models.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/defer_regress/models.py b/tests/regressiontests/defer_regress/models.py index e2a5944f92..11ce1557fe 100644 --- a/tests/regressiontests/defer_regress/models.py +++ b/tests/regressiontests/defer_regress/models.py @@ -3,6 +3,7 @@ Regression tests for defer() / only() behavior. """ from django.conf import settings +from django.contrib.contenttypes.models import ContentType from django.db import connection, models class Item(models.Model): @@ -91,5 +92,14 @@ u'c1' >>> Leaf.objects.select_related().only("child__name", "second_child__name") [<Leaf_Deferred_name_value: l1>] +Models instances with deferred fields should still return the same content +types as their non-deferred versions (bug #10738). +>>> ctype = ContentType.objects.get_for_model +>>> c1 = ctype(Item.objects.all()[0]) +>>> c2 = ctype(Item.objects.defer("name")[0]) +>>> c3 = ctype(Item.objects.only("name")[0]) +>>> c1 is c2 is c3 +True + """ } |
