Fixed a regression in select_related

The regression was caused by the fix for #13781 (commit
f51e409a5f). 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
1 changed files with 4 additions and 0 deletions

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] == '': if fields[pk_idx] == None or fields[pk_idx] == '':
obj = None obj = None
elif field_names: 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))) obj = klass(**dict(zip(field_names, fields)))
else: else:
obj = klass(*fields) obj = klass(*fields)