diff --git a/admin_tools/dashboard/templates/admin/index.html b/admin_tools/dashboard/templates/admin/index.html index 688a2d0..9687f6a 100644 --- a/admin_tools/dashboard/templates/admin/index.html +++ b/admin_tools/dashboard/templates/admin/index.html @@ -1,5 +1,5 @@ {% extends "admin/base_site.html" %} -{% load i18n admin_tools_dashboard_tags %} +{% load i18n admin_static admin_tools_dashboard_tags %} {% block extrastyle %} {{ block.super }} diff --git a/admin_tools/dashboard/templates/admin_tools/dashboard/css.html b/admin_tools/dashboard/templates/admin_tools/dashboard/css.html index 8bbd313..4a5d038 100644 --- a/admin_tools/dashboard/templates/admin_tools/dashboard/css.html +++ b/admin_tools/dashboard/templates/admin_tools/dashboard/css.html @@ -1,7 +1,8 @@ - - +{% load staticfiles %} + + -{% for css in css_files %} -{% endfor %} +{% for media_type, files in css_files.items %}{% for css in files %} +{% endfor %}{% endfor %} diff --git a/admin_tools/dashboard/templates/admin_tools/dashboard/dashboard.html b/admin_tools/dashboard/templates/admin_tools/dashboard/dashboard.html index 88831ae..0bacdc2 100644 --- a/admin_tools/dashboard/templates/admin_tools/dashboard/dashboard.html +++ b/admin_tools/dashboard/templates/admin_tools/dashboard/dashboard.html @@ -1,38 +1,38 @@ -{% load i18n admin_tools_dashboard_tags %} +{% load i18n staticfiles admin_tools_dashboard_tags %} {% block dashboard_scripts %} - + + + + {% block extrahead %}{% endblock %} {% block blockbots %}{% endblock %} @@ -28,27 +27,19 @@ {% if user.is_active and user.is_staff %}
- {% trans 'Welcome,' %} - {% filter force_escape %}{% firstof user.get_short_name user.first_name user.get_username user.username %}{% endfilter %}. + {% block welcome-msg %} + {% trans 'Welcome,' %} + {% firstof user.get_short_name user.get_username %}. + {% endblock %} {% block userlinks %} {% url 'django-admindocs-docroot' as docsroot %} {% if docsroot %} {% trans 'Documentation' %} / {% endif %} - {% url 'admin:password_change' as password_change_url %} - {% if password_change_url %} - - {% else %} - + {% if user.has_usable_password %} + {% trans 'Change password' %} / {% endif %} - {% trans 'Change password' %} / - {% url 'admin:logout' as logout_url %} - {% if logout_url %} - - {% else %} - - {% endif %} - {% trans 'Log out' %} + {% trans 'Log out' %} {% endblock %}
{% endif %} @@ -66,8 +57,8 @@ {% block messages %} {% if messages %} + {{ message|capfirst }} + {% endfor %} {% endif %} {% endblock messages %} diff --git a/admin_tools/theming/templatetags/theming_tags.py b/admin_tools/theming/templatetags/theming_tags.py index 17f7730..d21c49d 100644 --- a/admin_tools/theming/templatetags/theming_tags.py +++ b/admin_tools/theming/templatetags/theming_tags.py @@ -6,7 +6,7 @@ To load the theming tags just do: ``{% load theming_tags %}``. from django import template from django.conf import settings -from admin_tools.utils import get_media_url +from django.contrib.staticfiles.storage import staticfiles_storage register = template.Library() @@ -15,11 +15,9 @@ def render_theming_css(): Template tag that renders the needed css files for the theming app. """ css = getattr(settings, 'ADMIN_TOOLS_THEMING_CSS', False) - if css: - css = '/'.join([get_media_url(), css]) - else: - css = '/'.join([get_media_url(), 'admin_tools', 'css', 'theming.css']) - return '' % css + if not css: + css = '/'.join(['admin_tools', 'css', 'theming.css']) + return '' % staticfiles_storage.url(css) register.simple_tag(render_theming_css) diff --git a/admin_tools/utils.py b/admin_tools/utils.py index 676b4ea..8ff0412 100644 --- a/admin_tools/utils.py +++ b/admin_tools/utils.py @@ -154,14 +154,3 @@ class AppListElementMixin(object): return reverse('%s:%s_%s_add' % (get_admin_site_name(context), app_label, model.__name__.lower())) - -def get_media_url(): - """ - Returns the django admin tools media URL. - """ - media_url = getattr(settings, 'ADMIN_TOOLS_MEDIA_URL', None) - if media_url is None: - media_url = getattr(settings, 'STATIC_URL', None) - if media_url is None: - media_url = getattr(settings, 'MEDIA_URL') - return media_url.rstrip('/')