diff options
| author | Aymeric Augustin | 2014-01-08 21:36:01 +0100 |
|---|---|---|
| committer | Aymeric Augustin | 2014-01-08 21:40:57 +0100 |
| commit | c4224327f5e855d472d6f07316f374d209238411 (patch) | |
| tree | 188bc9a7992c4b11fa52014169d7e72060832776 | |
| parent | c11b64c598db64d10e4d316a6fde433fc5d20aed (diff) | |
| download | django-debug-toolbar-c4224327f5e855d472d6f07316f374d209238411.tar.bz2 | |
Test properly for django.contrib.staticfiles on Django 1.7.
The test in the staticfiles panel was redundant since the debug toolbar
now requires staticfiles.
| -rw-r--r-- | debug_toolbar/panels/staticfiles.py | 8 | ||||
| -rw-r--r-- | debug_toolbar/toolbar.py | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index efaf841..daf8909 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -6,7 +6,6 @@ except ImportError: threading = None from django.conf import settings -from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import get_storage_class from django.contrib.staticfiles import finders, storage from django.contrib.staticfiles.templatetags import staticfiles @@ -102,13 +101,6 @@ class StaticFilesPanel(panels.Panel): storage.staticfiles_storage = staticfiles.staticfiles_storage = _original_storage @property - def has_content(self): - if "django.contrib.staticfiles" not in settings.INSTALLED_APPS: - raise ImproperlyConfigured("Could not find staticfiles in " - "INSTALLED_APPS setting.") - return True - - @property def num_used(self): return len(self._paths[threading.currentThread()]) diff --git a/debug_toolbar/toolbar.py b/debug_toolbar/toolbar.py index 53b3182..03d4b7c 100644 --- a/debug_toolbar/toolbar.py +++ b/debug_toolbar/toolbar.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, unicode_literals import uuid +import django from django.conf import settings from django.conf.urls import patterns, url from django.core.exceptions import ImproperlyConfigured @@ -66,7 +67,14 @@ class DebugToolbar(object): context = {'toolbar': self} return render_to_string('debug_toolbar/base.html', context) except TemplateSyntaxError: - if 'django.contrib.staticfiles' not in settings.INSTALLED_APPS: + if django.VERSION[:2] >= (1, 7): + from django.apps import apps + staticfiles_installed = apps.is_installed( + 'django.contrib.staticfiles') + else: + staticfiles_installed = ('django.contrib.staticfiles' + in settings.INSTALLED_APPS) + if not staticfiles_installed: raise ImproperlyConfigured( "The debug toolbar requires the staticfiles contrib app. " "Add 'django.contrib.staticfiles' to INSTALLED_APPS and " |
