Commits

Nahuel Defosse committed 2894e11

Chain js and css requirements thourgh settings to avoid multiple js inclusions

Comments (0)

Files changed (1)

selectable/forms/widgets.py

 STATIC_URL = getattr(settings, 'STATIC_URL', u'')
 MEDIA_PREFIX = u'%sselectable/' % (STATIC_URL or MEDIA_URL)
 
+JS_JQUERY_URL = getattr(settings, 'JS_JQUERY_URL', 
+                'http://code.jquery.com/jquery-1.7.2.min.js')
+
+JS_JQUERY_UI_URL = getattr(settings, 'JS_JQUERY_UI_URL',
+        'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js')
+
+CSS_JQUERY_URL = getattr(settings, 'CSS_JQUERY_URL', 
+        'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/themes/smoothness/jquery-ui.css' )
 
 class SelectableMediaMixin(object):
 
     class Media(object):
         css = {
-            'all': (u'%scss/dj.selectable.css' % MEDIA_PREFIX, )
+            'all': (JS_JQUERY_URL,
+                    JS_JQUERY_UI_URL,
+                    u'%scss/dj.selectable.css' % MEDIA_PREFIX, )
         }
-        js = (u'%sjs/jquery.dj.selectable.js' % MEDIA_PREFIX, )
+        js = ( CSS_JQUERY_URL,
+                u'%sjs/jquery.dj.selectable.js' % MEDIA_PREFIX, )
 
 
 class AutoCompleteWidget(forms.TextInput, SelectableMediaMixin):