Added an _-prefix to pending lookups because it's transient.
This commit is contained in:
parent
86804ab063
commit
439b364e1e
|
@ -43,9 +43,6 @@ class AppCache(object):
|
|||
# Mapping of labels to AppConfig instances for installed apps.
|
||||
self.app_configs = OrderedDict()
|
||||
|
||||
# Pending lookups for lazy relations
|
||||
self.pending_lookups = {}
|
||||
|
||||
# Set of app names. Allows restricting the set of installed apps.
|
||||
# Used by TransactionTestCase.available_apps for performance reasons.
|
||||
self.available_apps = None
|
||||
|
@ -54,6 +51,9 @@ class AppCache(object):
|
|||
self._apps_loaded = not self.master
|
||||
self._models_loaded = not self.master
|
||||
|
||||
# Pending lookups for lazy relations.
|
||||
self._pending_lookups = {}
|
||||
|
||||
# Cache for get_models.
|
||||
self._get_models_cache = {}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ def add_lazy_relation(cls, field, relation, operation):
|
|||
else:
|
||||
key = (app_label, model_name)
|
||||
value = (cls, field, operation)
|
||||
cls._meta.app_cache.pending_lookups.setdefault(key, []).append(value)
|
||||
cls._meta.app_cache._pending_lookups.setdefault(key, []).append(value)
|
||||
|
||||
|
||||
def do_pending_lookups(sender, **kwargs):
|
||||
|
@ -82,7 +82,7 @@ def do_pending_lookups(sender, **kwargs):
|
|||
Handle any pending relations to the sending model. Sent from class_prepared.
|
||||
"""
|
||||
key = (sender._meta.app_label, sender.__name__)
|
||||
for cls, field, operation in sender._meta.app_cache.pending_lookups.pop(key, []):
|
||||
for cls, field, operation in sender._meta.app_cache._pending_lookups.pop(key, []):
|
||||
operation(field, sender, cls)
|
||||
|
||||
signals.class_prepared.connect(do_pending_lookups)
|
||||
|
|
Loading…
Reference in New Issue