summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-03-24 13:12:02 -0500
committerDan McGee <dan@archlinux.org>2012-03-24 13:12:02 -0500
commit5888bdf0db3aaa38f35f4630af86edf4b07f65e2 (patch)
tree47ba5f7809d9200500f8ee807bb93b3bdf410f8f
parent99a0e1bc76295243026ffbd41af10d62787b9ec0 (diff)
Use staticfiles_storage in jQuery tag
To get the local URL to the jQuery JS file. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--main/templatetags/cdn.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py
index f290a524..ab5d881a 100644
--- a/main/templatetags/cdn.py
+++ b/main/templatetags/cdn.py
@@ -1,8 +1,10 @@
from django import template
from django.conf import settings
+from django.contrib.staticfiles.storage import staticfiles_storage
register = template.Library()
+
@register.simple_tag
def jquery():
version = '1.4.4'
@@ -11,8 +13,8 @@ def jquery():
link = 'https://ajax.googleapis.com/ajax/libs/jquery/' \
'%s/jquery.min.js' % version
else:
- static_url = getattr(settings, 'STATIC_URL', '/static/')
- link = '%sjquery-%s.min.js' % (static_url, version)
+ filename = 'jquery-%s.min.js' % version
+ link = staticfiles_storage.url(filename)
return '<script type="text/javascript" src="%s"></script>' % link
# vim: set ts=4 sw=4 et: