diff --git a/django/db/models/loading.py b/django/db/models/loading.py index dc8e903c45..090390aa9e 100644 --- a/django/db/models/loading.py +++ b/django/db/models/loading.py @@ -7,9 +7,9 @@ import os import threading __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models', - 'load_app', 'cache_ready') + 'load_app', 'app_cache_ready') -class Cache(object): +class AppCache(object): """ A cache that stores installed applications and their models. Used to provide reverse-relations and for app introspection (e.g. admin). @@ -85,7 +85,7 @@ class Cache(object): self.app_store[mod.models] = len(self.app_store) return mod.models - def cache_ready(self): + def app_cache_ready(self): """ Returns true if the model cache is fully populated. @@ -177,7 +177,7 @@ class Cache(object): continue model_dict[model_name] = model -cache = Cache() +cache = AppCache() # These methods were always module level, so are kept that way for backwards # compatibility. @@ -188,4 +188,4 @@ get_models = cache.get_models get_model = cache.get_model register_models = cache.register_models load_app = cache.load_app -cache_ready = cache.cache_ready +app_cache_ready = cache.app_cache_ready diff --git a/django/db/models/options.py b/django/db/models/options.py index 499da1eb01..8cd9b58ec8 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -2,7 +2,7 @@ from django.conf import settings from django.db.models.related import RelatedObject from django.db.models.fields.related import ManyToManyRel from django.db.models.fields import AutoField, FieldDoesNotExist -from django.db.models.loading import get_models, cache_ready +from django.db.models.loading import get_models, app_cache_ready from django.db.models.query import orderlist2sql from django.db.models import Manager from django.utils.translation import activate, deactivate_all, get_language, string_concat @@ -179,7 +179,7 @@ class Options(object): for f in klass._meta.many_to_many: if f.rel and self == f.rel.to._meta: rel_objs.append(RelatedObject(f.rel.to, klass, f)) - if cache_ready(): + if app_cache_ready(): self._all_related_many_to_many_objects = rel_objs return rel_objs