1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Rewrote portions of the app- and model-cache initialisation to handle some corner cases. It is now possible to use m2m relations before everything is imported and still get the right results later when importing is complete. Also, get_apps() should always return the same results, so apps won't randomly disappear in the admin interface.

Also reorganised the structure of loading.py, since the number of global variables was exploding. The public API is still backwards compatible.

Fixed #1796 and #2438 (he claims, optimistically).


git-svn-id: http://code.djangoproject.com/svn/django/trunk@5919 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2007-08-17 17:23:15 +00:00
parent 103fe15efc
commit 3219a60167
2 changed files with 180 additions and 104 deletions

View File

@@ -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
from django.db.models.loading import get_models, 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,8 @@ 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))
self._all_related_many_to_many_objects = rel_objs
if cache_ready():
self._all_related_many_to_many_objects = rel_objs
return rel_objs
def get_ordered_objects(self):