Use Django's own static template tag in the admin.

This commit is contained in:
Jannis Leidel 2014-12-04 10:36:29 -08:00
parent 9e08cef4e0
commit 7a6e0602d3
3 changed files with 1 additions and 21 deletions

View file

@ -1,5 +1,5 @@
{% extends "admin/base_site.html" %}
{% load constance_tags admin_list i18n %}
{% load admin_static admin_list i18n %}
{% block extrastyle %}

View file

@ -1,20 +0,0 @@
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.core.files.storage import get_storage_class
try:
from django.contrib.staticfiles.storage import staticfiles_storage
except ImportError:
staticfiles_storage = get_storage_class(settings.STATICFILES_STORAGE)()
register = template.Library()
@register.simple_tag
def static(path):
"""
A template tag that returns the URL to a file
using staticfiles' storage backend
"""
return staticfiles_storage.url(path)