diff -ruN -x settings.py -x '*.pyc' -x '*.stackdump' -x '*.orig' -x '*.rej' ../Django-1.4c1.orig/django/db/models/query.py ../Django-1.4c1/django/db/models/query.py
old
|
new
|
|
1266 | 1266 | return None |
1267 | 1267 | |
1268 | 1268 | if only_load: |
1269 | | load_fields = only_load.get(klass) |
| 1269 | load_fields = only_load.get(klass) or set() |
1270 | 1270 | # When we create the object, we will also be creating populating |
1271 | 1271 | # all the parent classes, so traverse the parent classes looking |
1272 | 1272 | # for fields that must be included on load. |
diff -ruN -x settings.py -x '*.pyc' -x '*.stackdump' -x '*.orig' -x '*.rej' ../Django-1.4c1.orig/tests/modeltests/defer/models.py ../Django-1.4c1/tests/modeltests/defer/models.py
old
|
new
|
|
22 | 22 | |
23 | 23 | class BigChild(Primary): |
24 | 24 | other = models.CharField(max_length=50) |
| 25 | |
| 26 | class ChildProxy(Child): |
| 27 | class Meta: |
| 28 | proxy=True |
diff -ruN -x settings.py -x '*.pyc' -x '*.stackdump' -x '*.orig' -x '*.rej' ../Django-1.4c1.orig/tests/modeltests/defer/tests.py ../Django-1.4c1/tests/modeltests/defer/tests.py
old
|
new
|
|
3 | 3 | from django.db.models.query_utils import DeferredAttribute |
4 | 4 | from django.test import TestCase |
5 | 5 | |
6 | | from .models import Secondary, Primary, Child, BigChild |
| 6 | from .models import Secondary, Primary, Child, BigChild, ChildProxy |
7 | 7 | |
8 | 8 | |
9 | 9 | class DeferTests(TestCase): |
… |
… |
|
145 | 145 | obj.name = "bb" |
146 | 146 | obj.save() |
147 | 147 | |
| 148 | # using select related and only should not result in Exception |
| 149 | for obj in ChildProxy.objects.all().select_related().only('id'): |
| 150 | continue |