Ticket #18975: 18975.diff

File 18975.diff, 1.2 KB (added by FunkyBob, 12 years ago)

Passes on git rev 9db7652

  • django/db/models/loading.py

    diff --git a/django/db/models/loading.py b/django/db/models/loading.py
    index 7a9cb2c..5808036 100644
    a b class AppCache(object):  
    231231            model_name = model._meta.object_name.lower()
    232232            model_dict = self.app_models.setdefault(app_label, SortedDict())
    233233            if model_name in model_dict:
    234                 # The same model may be imported via different paths (e.g.
    235                 # appname.models and project.appname.models). We use the source
    236                 # filename as a means to detect identity.
    237                 fname1 = os.path.abspath(sys.modules[model.__module__].__file__)
    238                 fname2 = os.path.abspath(sys.modules[model_dict[model_name].__module__].__file__)
    239                 # Since the filename extension could be .py the first time and
    240                 # .pyc or .pyo the second time, ignore the extension when
    241                 # comparing.
    242                 if os.path.splitext(fname1)[0] == os.path.splitext(fname2)[0]:
     234                if model is model_dict[model_name]:
    243235                    continue
    244236            model_dict[model_name] = model
    245237        self._get_models_cache.clear()
Back to Top