1
0
mirror of https://github.com/django/django.git synced 2024-12-24 18:16:19 +00:00

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

View File

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