1
0
mirror of https://github.com/django/django.git synced 2025-01-11 02:46:13 +00:00

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:
Carl Meyer 2011-01-26 08:39:30 +00:00
parent 8151c0431e
commit a9b4f2a400

View File

@ -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,