mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fix #17876: Corrected an exception (regression) raised where select_realted and only is used on a proxy model. Thanks milosu and charettes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17692 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -22,3 +22,7 @@ class Child(Primary):
|
||||
|
||||
class BigChild(Primary):
|
||||
other = models.CharField(max_length=50)
|
||||
|
||||
class ChildProxy(Child):
|
||||
class Meta:
|
||||
proxy=True
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import absolute_import
|
||||
from django.db.models.query_utils import DeferredAttribute
|
||||
from django.test import TestCase
|
||||
|
||||
from .models import Secondary, Primary, Child, BigChild
|
||||
from .models import Secondary, Primary, Child, BigChild, ChildProxy
|
||||
|
||||
|
||||
class DeferTests(TestCase):
|
||||
@@ -145,3 +145,7 @@ class DeferTests(TestCase):
|
||||
obj.name = "bb"
|
||||
obj.save()
|
||||
|
||||
def test_defer_proxy(self):
|
||||
# using select related and only should not result in Exception
|
||||
for obj in ChildProxy.objects.all().select_related().only('id'):
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user