diff --git a/django/db/models/loading.py b/django/db/models/loading.py
index 7a9cb2c..5808036 100644
|
a
|
b
|
class AppCache(object):
|
| 231 | 231 | model_name = model._meta.object_name.lower() |
| 232 | 232 | model_dict = self.app_models.setdefault(app_label, SortedDict()) |
| 233 | 233 | 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]: |
| 243 | 235 | continue |
| 244 | 236 | model_dict[model_name] = model |
| 245 | 237 | self._get_models_cache.clear() |