Changeset 7721 for django/trunk/django/db/models/loading.py
- Timestamp:
- 06/21/08 15:55:17 (7 months ago)
- Files:
-
- django/trunk/django/db/models/loading.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/db/models/loading.py
r7679 r7721 3 3 from django.conf import settings 4 4 from django.core.exceptions import ImproperlyConfigured 5 from django.utils.datastructures import SortedDict 6 5 7 import sys 6 8 import os … … 19 21 __shared_state = dict( 20 22 # Keys of app_store are the model modules for each application. 21 app_store = {},23 app_store = SortedDict(), 22 24 23 25 # Mapping of app_labels to a dictionary of model names to model code. 24 app_models = {},26 app_models = SortedDict(), 25 27 26 28 # Mapping of app_labels to errors raised when trying to import the app. … … 134 136 self._populate() 135 137 if app_mod: 136 return self.app_models.get(app_mod.__name__.split('.')[-2], {}).values()138 return self.app_models.get(app_mod.__name__.split('.')[-2], SortedDict()).values() 137 139 else: 138 140 model_list = [] … … 150 152 if seed_cache: 151 153 self._populate() 152 return self.app_models.get(app_label, {}).get(model_name.lower())154 return self.app_models.get(app_label, SortedDict()).get(model_name.lower()) 153 155 154 156 def register_models(self, app_label, *models): … … 160 162 # in the app_models dictionary 161 163 model_name = model._meta.object_name.lower() 162 model_dict = self.app_models.setdefault(app_label, {})164 model_dict = self.app_models.setdefault(app_label, SortedDict()) 163 165 if model_name in model_dict: 164 166 # The same model may be imported via different paths (e.g.
