summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2014-01-24 20:07:14 -0700
committerCarl Meyer <carl@oddbird.net>2014-01-24 20:07:14 -0700
commit29ddae7436e84f4713c7babeabdf9a1fa62d6543 (patch)
tree05f883c76540aca8bc2459fa52be5bc4c45e4bc7
parentf5f556dba3c89333d4533e0603de79b62083d807 (diff)
Fixed #21871 -- Fixed Apps.is_installed() for apps with custom label.
Thanks Aymeric for design discussion.
-rw-r--r--django/apps/registry.py3
-rw-r--r--tests/apps/apps.py1
-rw-r--r--tests/apps/tests.py1
3 files changed, 3 insertions, 2 deletions
diff --git a/django/apps/registry.py b/django/apps/registry.py
index fcd5f576e6..649ba42d78 100644
--- a/django/apps/registry.py
+++ b/django/apps/registry.py
@@ -204,8 +204,7 @@ class Apps(object):
It's safe to call this method at import time, even while the registry
is being populated. It returns False for apps that aren't loaded yet.
"""
- app_config = self.app_configs.get(app_name.rpartition(".")[2])
- return app_config is not None and app_config.name == app_name
+ return any(ac.name == app_name for ac in self.app_configs.values())
def get_containing_app_config(self, object_name):
"""
diff --git a/tests/apps/apps.py b/tests/apps/apps.py
index a2c49fcbff..7faa63e435 100644
--- a/tests/apps/apps.py
+++ b/tests/apps/apps.py
@@ -10,6 +10,7 @@ class MyAdmin(AppConfig):
class MyAuth(AppConfig):
name = 'django.contrib.auth'
+ label = 'myauth'
verbose_name = "All your password are belong to us."
diff --git a/tests/apps/tests.py b/tests/apps/tests.py
index ad5fd0d609..139bc06a66 100644
--- a/tests/apps/tests.py
+++ b/tests/apps/tests.py
@@ -109,6 +109,7 @@ class AppsTests(TestCase):
@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
def test_is_installed(self):
self.assertTrue(apps.is_installed('django.contrib.admin'))
+ self.assertTrue(apps.is_installed('django.contrib.auth'))
self.assertTrue(apps.is_installed('django.contrib.staticfiles'))
self.assertFalse(apps.is_installed('django.contrib.webdesign'))