From 5888bdf0db3aaa38f35f4630af86edf4b07f65e2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 24 Mar 2012 13:12:02 -0500 Subject: Use staticfiles_storage in jQuery tag To get the local URL to the jQuery JS file. Signed-off-by: Dan McGee --- main/templatetags/cdn.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'main') diff --git a/main/templatetags/cdn.py b/main/templatetags/cdn.py index f290a52..ab5d881 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 '' % link # vim: set ts=4 sw=4 et: -- cgit v1.2.3-24-g4f1b