summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authore0ne <e0ne@e0ne.info>2013-09-13 08:08:34 -0400
committerTim Graham <timograham@gmail.com>2013-09-13 08:09:21 -0400
commitc1ec08998d1b690855d5e69a1f4d9d2f01d44ae6 (patch)
treeedd8e91acfabfd37de97752df64992bc93ce85f4
parentad6fcdb8d24d84a130f847f45b51d7e892ccca08 (diff)
Fixed #12288 -- Validated that app names in INSTALLED_APPS are unique
-rw-r--r--django/conf/__init__.py5
-rw-r--r--tests/settings_tests/tests.py5
2 files changed, 7 insertions, 3 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index 199c34fb55..6266ca2394 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -109,8 +109,9 @@ class BaseSettings(object):
"to a tuple, not a string.")
elif name == "INSTALLED_APPS":
value = list(value) # force evaluation of generators on Python 3
- if len(value) != len(set(value)):
- raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique values.")
+ apps = [s.split('.')[-1] for s in value]
+ if len(value) != len(set(apps)):
+ raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique app names.")
object.__setattr__(self, name, value)
diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py
index a9503358a2..0ffb56bb82 100644
--- a/tests/settings_tests/tests.py
+++ b/tests/settings_tests/tests.py
@@ -241,11 +241,14 @@ class UniqueSettingsTests(TestCase):
def test_unique(self):
"""
An ImproperlyConfigured exception is raised if the INSTALLED_APPS contains
- any duplicate strings.
+ any duplicate appication names.
"""
with self.assertRaises(ImproperlyConfigured):
self.settings_module.INSTALLED_APPS = ("myApp1", "myApp1", "myApp2", "myApp3")
+ with self.assertRaises(ImproperlyConfigured):
+ self.settings_module.INSTALLED_APPS = ("package1.myApp1", "package2.myApp1")
+
class TrailingSlashURLTests(TestCase):
"""