Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12288 -- Validated that app names in INSTALLED_APPS are unique

  • Loading branch information...
commit c1ec08998d1b690855d5e69a1f4d9d2f01d44ae6 1 parent ad6fcdb
Ivan Kolodyazhny authored September 13, 2013 timgraham committed September 13, 2013
5  django/conf/__init__.py
@@ -109,8 +109,9 @@ def __setattr__(self, name, value):
109 109
                 "to a tuple, not a string.")
110 110
         elif name == "INSTALLED_APPS":
111 111
             value = list(value)  # force evaluation of generators on Python 3
112  
-            if len(value) != len(set(value)):
113  
-                raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique values.")
  112
+            apps = [s.split('.')[-1] for s in value]
  113
+            if len(value) != len(set(apps)):
  114
+                raise ImproperlyConfigured("The INSTALLED_APPS setting must contain unique app names.")
114 115
 
115 116
         object.__setattr__(self, name, value)
116 117
 
5  tests/settings_tests/tests.py
@@ -241,11 +241,14 @@ def tearDown(self):
241 241
     def test_unique(self):
242 242
         """
243 243
         An ImproperlyConfigured exception is raised if the INSTALLED_APPS contains
244  
-        any duplicate strings.
  244
+        any duplicate appication names.
245 245
         """
246 246
         with self.assertRaises(ImproperlyConfigured):
247 247
             self.settings_module.INSTALLED_APPS = ("myApp1", "myApp1", "myApp2", "myApp3")
248 248
 
  249
+        with self.assertRaises(ImproperlyConfigured):
  250
+            self.settings_module.INSTALLED_APPS = ("package1.myApp1", "package2.myApp1")
  251
+
249 252
 
250 253
 class TrailingSlashURLTests(TestCase):
251 254
     """

0 notes on commit c1ec089

Please sign in to comment.
Something went wrong with that request. Please try again.