Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21871 -- Fixed Apps.is_installed() for apps with custom label.

Thanks Aymeric for design discussion.
  • Loading branch information...
commit 29ddae7436e84f4713c7babeabdf9a1fa62d6543 1 parent f5f556d
@carljm carljm authored
View
3  django/apps/registry.py
@@ -204,8 +204,7 @@ def is_installed(self, app_name):
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):
"""
View
1  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."
View
1  tests/apps/tests.py
@@ -109,6 +109,7 @@ def test_get_app_config(self):
@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'))
Please sign in to comment.
Something went wrong with that request. Please try again.