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 /debug_toolbar/toolbar.py | |
| 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.
Diffstat (limited to 'debug_toolbar/toolbar.py')
| -rw-r--r-- | debug_toolbar/toolbar.py | 10 | 
1 files changed, 9 insertions, 1 deletions
| 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 " | 
