mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
related object, populate the attribute correctly. Patch from Bastien Kleineidam. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8098 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
aee55ce524
commit
f48855178d
2 changed files with 14 additions and 10 deletions
|
@ -785,7 +785,11 @@ def get_cached_row(klass, row, index_start, max_depth=0, cur_depth=0,
|
|||
|
||||
restricted = requested is not None
|
||||
index_end = index_start + len(klass._meta.fields)
|
||||
obj = klass(*row[index_start:index_end])
|
||||
fields = row[index_start:index_end]
|
||||
if not [x for x in fields if x is not None]:
|
||||
# If we only have a list of Nones, there was not related object.
|
||||
return None, index_end
|
||||
obj = klass(*fields)
|
||||
for f in klass._meta.fields:
|
||||
if not select_related_descend(f, restricted, requested):
|
||||
continue
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue