1
0
mirror of https://github.com/django/django.git synced 2025-03-06 07:22:32 +00:00

Fixed a regression in select_related

The regression was caused by the fix for #13781 (commit
f51e409a5fb34020e170494320a421503689aea0). Reason was leaving
off some crucial lines when resolving a merge conflict.
This commit is contained in:
Anssi Kääriäinen 2012-11-15 20:17:57 +02:00
parent 71e14cf3aa
commit 1194a96999

View File

@ -1446,6 +1446,10 @@ def get_cached_row(row, index_start, using, klass_info, offset=0,
if fields[pk_idx] == None or fields[pk_idx] == '':
obj = None
elif field_names:
fields = list(fields)
for rel_field, value in parent_data:
field_names.append(rel_field.attname)
fields.append(value)
obj = klass(**dict(zip(field_names, fields)))
else:
obj = klass(*fields)