Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added comments to clarify the string->field name resolution logic.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6cbdbffc80fde098ed491dc2aea4d1f3105b3ad6 1 parent 0d4b5b9
Russell Keith-Magee freakboy3742 authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  django/db/models/fields/
3  django/db/models/fields/
@@ -23,11 +23,14 @@ def add_lookup(rel_cls, field):
name =
module = rel_cls.__module__
key = (module, name)
+ # Has the model already been loaded?
+ # If so, resolve the string reference right away
model = get_model(rel_cls._meta.app_label,
if model: = model
field.do_related_class(model, rel_cls)
+ # Mark the related field for later lookup
pending_lookups.setdefault(key, []).append((rel_cls, field))
def do_pending_lookups(sender):
Please sign in to comment.
Something went wrong with that request. Please try again.