Tweaked r15303 to avoid O(N) lookup of field name. Thanks to Alex's eagle eyes.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15324 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8151c0431e
commit
a9b4f2a400
|
@ -1367,7 +1367,8 @@ class Query(object):
|
|||
# In case of a recursive FK, use the to_field for
|
||||
# reverse lookups as well
|
||||
if orig_field.model is local_field.model:
|
||||
target = opts.get_field(field.rel.field_name)
|
||||
target = opts.get_field_by_name(
|
||||
field.rel.field_name)[0]
|
||||
else:
|
||||
target = opts.pk
|
||||
orig_opts._join_cache[name] = (table, from_col, to_col,
|
||||
|
|
Loading…
Reference in New Issue