diff options
| -rw-r--r-- | debug_toolbar/apps.py | 15 | ||||
| -rw-r--r-- | debug_toolbar/models.py | 4 | ||||
| -rw-r--r-- | docs/installation.rst | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/debug_toolbar/apps.py b/debug_toolbar/apps.py new file mode 100644 index 0000000..17f8dad --- /dev/null +++ b/debug_toolbar/apps.py @@ -0,0 +1,15 @@ +from __future__ import absolute_import, unicode_literals + +from django.apps import AppConfig +from django.utils.translation import ugettext_lazy as _ + +from debug_toolbar import settings as dt_settings + + +class DebugToolbarConfig(AppConfig): + name = 'debug_toolbar' + verbose_name = _("Debug Toolbar") + + def ready(self): + if dt_settings.PATCH_SETTINGS: + dt_settings.patch_all() diff --git a/debug_toolbar/models.py b/debug_toolbar/models.py index eb16e3a..1874748 100644 --- a/debug_toolbar/models.py +++ b/debug_toolbar/models.py @@ -1,7 +1,9 @@ from __future__ import absolute_import, unicode_literals +import django + from debug_toolbar import settings as dt_settings -if dt_settings.PATCH_SETTINGS: +if dt_settings.PATCH_SETTINGS and django.VERSION[:2] < (1, 7): dt_settings.patch_all() diff --git a/docs/installation.rst b/docs/installation.rst index f761e91..70ca46e 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -23,12 +23,16 @@ Quick setup Make sure that ``'django.contrib.staticfiles'`` is `set up properly <https://docs.djangoproject.com/en/stable/howto/static-files/>`_ and add -``'debug_toolbar'`` to your ``INSTALLED_APPS`` setting:: +``'debug_toolbar.apps.DebugToolbarConfig'`` (Django ≥ 1.7) or +``'debug_toolbar'`` (Django < 1.7) to your ``INSTALLED_APPS`` setting:: INSTALLED_APPS = ( # ... 'django.contrib.staticfiles', # ... + # If you're using Django 1.7.x or later + 'debug_toolbar.apps.DebugToolbarConfig', + # If you're using Django 1.6.x or earlier 'debug_toolbar', ) |
