diff options
| author | Jannis Leidel | 2013-12-23 12:43:49 +0100 |
|---|---|---|
| committer | Jannis Leidel | 2013-12-23 12:43:49 +0100 |
| commit | 4225671177f9f65e873ddbab373e5968c2afa8fc (patch) | |
| tree | 7c7b8f5280ed84d49af311a56e1039706ce9029a /debug_toolbar | |
| parent | 9298aff6ed93cd2463730f31c1576bf9e396084e (diff) | |
| download | django-debug-toolbar-4225671177f9f65e873ddbab373e5968c2afa8fc.tar.bz2 | |
Fix staticfiles panel to work with prefixed STATICFILES_DIRS.
Closes #503 and #507. Many thanks to Alexander Clausen (@sk1p) for the
inspiration for the patch.
Diffstat (limited to 'debug_toolbar')
| -rw-r--r-- | debug_toolbar/locale/en/LC_MESSAGES/django.po | 7 | ||||
| -rw-r--r-- | debug_toolbar/panels/staticfiles.py | 7 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/staticfiles.html | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/debug_toolbar/locale/en/LC_MESSAGES/django.po b/debug_toolbar/locale/en/LC_MESSAGES/django.po index 6102d0d..06237f7 100644 --- a/debug_toolbar/locale/en/LC_MESSAGES/django.po +++ b/debug_toolbar/locale/en/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Django Debug Toolbar\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-15 13:11+0100\n" +"POT-Creation-Date: 2013-12-23 12:40+0100\n" "PO-Revision-Date: 2012-03-31 20:10+0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -557,6 +557,11 @@ msgid_plural "Static file paths" msgstr[0] "" msgstr[1] "" +#: templates/debug_toolbar/panels/staticfiles.html:8 +#, python-format +msgid "(prefix %(prefix)s)" +msgstr "" + #: templates/debug_toolbar/panels/staticfiles.html:12 #: templates/debug_toolbar/panels/staticfiles.html:23 #: templates/debug_toolbar/panels/staticfiles.html:35 diff --git a/debug_toolbar/panels/staticfiles.py b/debug_toolbar/panels/staticfiles.py index f212f2b..efaf841 100644 --- a/debug_toolbar/panels/staticfiles.py +++ b/debug_toolbar/panels/staticfiles.py @@ -163,8 +163,11 @@ class StaticFilesPanel(panels.Panel): """ Returns a list of paths to inspect for additional static files """ - dirs = getattr(settings, 'STATICFILES_DIRS', ()) - return [normpath(d) for d in dirs] + dirs = [] + for finder in finders.get_finders(): + if isinstance(finder, finders.FileSystemFinder): + dirs.extend(finder.locations) + return [(prefix, normpath(dir)) for prefix, dir in dirs] def get_staticfiles_apps(self): """ diff --git a/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html b/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html index eb413b5..95c9ec8 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html +++ b/debug_toolbar/templates/debug_toolbar/panels/staticfiles.html @@ -4,8 +4,8 @@ <h4>{% blocktrans count staticfiles_dirs|length as dirs_count %}Static file path{% plural %}Static file paths{% endblocktrans %}</h4> {% if staticfiles_dirs %} <ol> - {% for staticfiles_dir in staticfiles_dirs %} - <li>{{ staticfiles_dir }}</li> + {% for prefix, staticfiles_dir in staticfiles_dirs %} + <li>{{ staticfiles_dir }}{% if prefix %} {% blocktrans %}(prefix {{ prefix }}){% endblocktrans %}{% endif %}</li> {% endfor %} </ol> {% else %} |
