Skip to content
Browse files

Tweaked r15303 to avoid O(N) lookup of field name. Thanks to Alex's e…

…agle eyes.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 8151c04 commit a9b4f2a40043cdf8e61dce7e623028ba33ffd6af @carljm carljm committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 django/db/models/sql/
3 django/db/models/sql/
@@ -1367,7 +1367,8 @@ def setup_joins(self, names, opts, alias, dupe_multis, allow_many=True,
# 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]
target =
orig_opts._join_cache[name] = (table, from_col, to_col,

0 comments on commit a9b4f2a

Please sign in to comment.
Something went wrong with that request. Please try again.