1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Fixed a problem when computing deferred fields on multiple related models.

Fixed #10710, as this fixes the second bug reported there.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10384 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2009-04-04 05:35:01 +00:00
parent 0a89a57ffc
commit 2b1934ff3c
2 changed files with 7 additions and 3 deletions

View File

@@ -574,12 +574,13 @@ class BaseQuery(object):
if not field_names:
return
columns = set()
cur_model = self.model
opts = cur_model._meta
orig_opts = self.model._meta
seen = {}
must_include = {cur_model: set([opts.pk])}
must_include = {self.model: set([orig_opts.pk])}
for field_name in field_names:
parts = field_name.split(LOOKUP_SEP)
cur_model = self.model
opts = orig_opts
for name in parts[:-1]:
old_model = cur_model
source = opts.get_field_by_name(name)[0]