Loading django/apps/cache.py +1 −1 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ class AppCache(object): app_config = self.app_configs.get(app_name.rpartition(".")[2]) return app_config is not None and app_config.name == app_name: def has_model(self, app_label, model_name): def get_registered_model(self, app_label, model_name): """ Returns the model class if one is registered and None otherwise. Loading django/db/models/base.py +2 −2 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ class ModelBase(type): new_class._base_manager = new_class._base_manager._copy_to_model(new_class) # Bail out early if we have already created this class. m = new_class._meta.app_cache.has_model(new_class._meta.app_label, name) m = new_class._meta.app_cache.get_registered_model(new_class._meta.app_label, name) if m is not None: return m Loading Loading @@ -278,7 +278,7 @@ class ModelBase(type): # the first time this model tries to register with the framework. There # should only be one class for each model, so we always return the # registered version. return new_class._meta.app_cache.has_model(new_class._meta.app_label, name) return new_class._meta.app_cache.get_registered_model(new_class._meta.app_label, name) def copy_managers(cls, base_managers): # This is in-place sorting of an Options attribute, but that's fine. Loading django/db/models/fields/related.py +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ def add_lazy_relation(cls, field, relation, operation): # string right away. If get_model returns None, it means that the related # model isn't loaded yet, so we need to pend the relation until the class # is prepared. model = cls._meta.app_cache.has_model(app_label, model_name) model = cls._meta.app_cache.get_registered_model(app_label, model_name) if model: operation(field, model, cls) else: Loading Loading
django/apps/cache.py +1 −1 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ class AppCache(object): app_config = self.app_configs.get(app_name.rpartition(".")[2]) return app_config is not None and app_config.name == app_name: def has_model(self, app_label, model_name): def get_registered_model(self, app_label, model_name): """ Returns the model class if one is registered and None otherwise. Loading
django/db/models/base.py +2 −2 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ class ModelBase(type): new_class._base_manager = new_class._base_manager._copy_to_model(new_class) # Bail out early if we have already created this class. m = new_class._meta.app_cache.has_model(new_class._meta.app_label, name) m = new_class._meta.app_cache.get_registered_model(new_class._meta.app_label, name) if m is not None: return m Loading Loading @@ -278,7 +278,7 @@ class ModelBase(type): # the first time this model tries to register with the framework. There # should only be one class for each model, so we always return the # registered version. return new_class._meta.app_cache.has_model(new_class._meta.app_label, name) return new_class._meta.app_cache.get_registered_model(new_class._meta.app_label, name) def copy_managers(cls, base_managers): # This is in-place sorting of an Options attribute, but that's fine. Loading
django/db/models/fields/related.py +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ def add_lazy_relation(cls, field, relation, operation): # string right away. If get_model returns None, it means that the related # model isn't loaded yet, so we need to pend the relation until the class # is prepared. model = cls._meta.app_cache.has_model(app_label, model_name) model = cls._meta.app_cache.get_registered_model(app_label, model_name) if model: operation(field, model, cls) else: Loading