Commits

David Jean Louis committed 28b676b

build urlpatterns conditionally regarding the content of INSTALLED_APPS

  • Participants
  • Parent commits b612f71

Comments (0)

Files changed (1)

admin_tools/urls.py

+from django.conf import settings
 from django.conf.urls.defaults import patterns, url, include
 
-urlpatterns = patterns('',
-    url(r'^menu/', include('admin_tools.menu.urls')),
-    url(r'^dashboard/', include('admin_tools.dashboard.urls')),
-)
+urls = []
+if 'admin_tools.menu' in settings.INSTALLED_APPS:
+    urls.append(url(r'^menu/', include('admin_tools.menu.urls')))
+if 'admin_tools.dashboard' in settings.INSTALLED_APPS:
+    urls.append(url(r'^dashboard/', include('admin_tools.dashboard.urls')))
+
+urlpatterns = patterns('', *urls)