mirror of https://github.com/django/django.git
Changed has_app to return a boolean.
That matches its name ad its purpose better.
This commit is contained in:
parent
ba60fcbcf7
commit
4f064c2f05
|
@ -300,15 +300,15 @@ class AppCache(object):
|
||||||
|
|
||||||
def has_app(self, app_name):
|
def has_app(self, app_name):
|
||||||
"""
|
"""
|
||||||
Returns the application config if one is registered and None otherwise.
|
Checks whether an application with this name exists in the app cache.
|
||||||
|
|
||||||
|
app_name is the full name of the app eg. 'django.contrib.admin'.
|
||||||
|
|
||||||
It's safe to call this method at import time, even while the app cache
|
It's safe to call this method at import time, even while the app cache
|
||||||
is being populated. It returns None for apps that aren't loaded yet.
|
is being populated. It returns None for apps that aren't loaded yet.
|
||||||
"""
|
"""
|
||||||
app_config = self.app_configs.get(app_name.rpartition(".")[2])
|
app_config = self.app_configs.get(app_name.rpartition(".")[2])
|
||||||
if app_config is not None and app_config.name != app_name:
|
return app_config is not None and app_config.name == app_name:
|
||||||
app_config = None
|
|
||||||
return app_config
|
|
||||||
|
|
||||||
def has_model(self, app_label, model_name):
|
def has_model(self, app_label, model_name):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue