Changed has_app to return a boolean.

That matches its name ad its purpose better.
This commit is contained in:
Aymeric Augustin 2013-12-22 17:07:18 +01:00
parent ba60fcbcf7
commit 4f064c2f05
1 changed files with 4 additions and 4 deletions

View File

@ -300,15 +300,15 @@ class AppCache(object):
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
is being populated. It returns None for apps that aren't loaded yet.
"""
app_config = self.app_configs.get(app_name.rpartition(".")[2])
if app_config is not None and app_config.name != app_name:
app_config = None
return app_config
return app_config is not None and app_config.name == app_name:
def has_model(self, app_label, model_name):
"""