1
0
mirror of https://github.com/django/django.git synced 2025-10-30 00:56:09 +00:00

Fixed #15790 -- Fixed QuerySet only() and defer() methods behavior with proxy models. Thanks Michal Modzelewzki for the report and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16228 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Ramiro Morales
2011-05-15 00:56:01 +00:00
parent c5cb2fabd2
commit 07bfc76ecf
3 changed files with 26 additions and 2 deletions

View File

@@ -553,7 +553,10 @@ class Query(object):
columns = set()
orig_opts = self.model._meta
seen = {}
must_include = {self.model: set([orig_opts.pk])}
if orig_opts.proxy:
must_include = {orig_opts.proxy_for_model: set([orig_opts.pk])}
else:
must_include = {self.model: set([orig_opts.pk])}
for field_name in field_names:
parts = field_name.split(LOOKUP_SEP)
cur_model = self.model