Code

Ticket #10738: deferred_model_contenttype_tests.diff

File deferred_model_contenttype_tests.diff, 611 bytes (added by tomasz.elendt, 5 years ago)
Line 
1Index: tests/modeltests/defer/models.py
2===================================================================
3--- tests/modeltests/defer/models.py    (revision 10433)
4+++ tests/modeltests/defer/models.py    (working copy)
5@@ -98,5 +98,10 @@
6 >>> Primary.objects.all()
7 [<Primary: a new name>]
8 
9-
10+Model instances with deferred fields should have the same ContentType
11+>>> from django.contrib.contenttypes.models import ContentType
12+>>> ContentType.objects.get_for_model(qs[0]) is \
13+    ContentType.objects.get_for_model(qs.defer('name')[0]) is \
14+    ContentType.objects.get_for_model(qs.only('name')[0])
15+True
16 """}