Used the proxied call to staticfiles_storage.url

This commit is contained in:
Thomas Grainger 2014-01-15 12:53:19 +00:00 committed by Tim Graham
parent 9ab798a8d8
commit a42e04f77d
1 changed files with 5 additions and 5 deletions

View File

@ -5,11 +5,15 @@ from django.contrib.staticfiles.storage import staticfiles_storage
register = template.Library() register = template.Library()
def static(path):
return staticfiles_storage.url(path)
class StaticFilesNode(StaticNode): class StaticFilesNode(StaticNode):
def url(self, context): def url(self, context):
path = self.path.resolve(context) path = self.path.resolve(context)
return staticfiles_storage.url(path) return static(path)
@register.tag('static') @register.tag('static')
@ -31,7 +35,3 @@ def do_static(parser, token):
""" """
return StaticFilesNode.handle_token(parser, token) return StaticFilesNode.handle_token(parser, token)
def static(path):
return staticfiles_storage.url(path)