Browse files

Fixed a regression in select_related

The regression was caused by the fix for #13781 (commit
f51e409). Reason was leaving
off some crucial lines when resolving a merge conflict.
  • Loading branch information...
1 parent 71e14cf commit 1194a9699932088385f9f88869be28a251597f45 @akaariai akaariai committed Nov 15, 2012
Showing with 4 additions and 0 deletions.
  1. +4 −0 django/db/models/query.py
View
4 django/db/models/query.py
@@ -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)

0 comments on commit 1194a96

Please sign in to comment.