mirror of https://github.com/django/django.git
Renamed Cache to AppCache and cache_ready() to app_cache_ready() from [5919] in order to avoid any potential confusion with Django's caching middleware functionality when reading the code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5922 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a89e401648
commit
7969c1ba05
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue