diff --git a/docs/index.rst b/docs/index.rst index a6c8250..1d04b1a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,7 +11,6 @@ Contents :numbered: 1 installation - settings usage diff --git a/docs/installation.md b/docs/installation.md index 83a1c1e..8ea706a 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -15,5 +15,3 @@ url(r'^chaining/', include('smart_selects.urls')), ) ``` - -4. You will also need to include jQuery in every page that includes a field from `smart_selects`, or set `JQUERY_URL = True` in your project's `settings.py`. diff --git a/docs/settings.md b/docs/settings.md deleted file mode 100644 index f0b3a97..0000000 --- a/docs/settings.md +++ /dev/null @@ -1,10 +0,0 @@ -## Settings - -`JQUERY_URL` -: jQuery 2.2.0 is loaded from Google's CDN if this is set to `True`. If you would prefer to - use a different version put the full URL here. Set `JQUERY_URL = False` - to disable loading jQuery altogether. - -`USE_DJANGO_JQUERY` -: By default, `smart_selects` loads jQuery from Google's CDN. However, it can use jQuery from Django's - admin area. Set `USE_DJANGO_JQUERY = True` to enable this behaviour. diff --git a/smart_selects/static/smart-selects/admin/js/bindfields.js b/smart_selects/static/smart-selects/admin/js/bindfields.js index 295d563..3ec04fe 100755 --- a/smart_selects/static/smart-selects/admin/js/bindfields.js +++ b/smart_selects/static/smart-selects/admin/js/bindfields.js @@ -87,4 +87,4 @@ } }); }); -}(jQuery || django.jQuery)); +}(django.jQuery)); diff --git a/smart_selects/static/smart-selects/admin/js/chainedfk.js b/smart_selects/static/smart-selects/admin/js/chainedfk.js index 980750f..76c4f7c 100755 --- a/smart_selects/static/smart-selects/admin/js/chainedfk.js +++ b/smart_selects/static/smart-selects/admin/js/chainedfk.js @@ -110,4 +110,4 @@ } }; }(); -}(jQuery || django.jQuery)); +}(django.jQuery)); diff --git a/smart_selects/static/smart-selects/admin/js/chainedm2m.js b/smart_selects/static/smart-selects/admin/js/chainedm2m.js index 99a4cbb..380db9a 100755 --- a/smart_selects/static/smart-selects/admin/js/chainedm2m.js +++ b/smart_selects/static/smart-selects/admin/js/chainedm2m.js @@ -178,4 +178,4 @@ } }; }(); -}(jQuery || django.jQuery)); +}(django.jQuery)); diff --git a/smart_selects/widgets.py b/smart_selects/widgets.py index 4c8f2e0..4fae0ce 100644 --- a/smart_selects/widgets.py +++ b/smart_selects/widgets.py @@ -13,13 +13,6 @@ get_model = apps.get_model -USE_DJANGO_JQUERY = getattr(settings, "USE_DJANGO_JQUERY", False) -JQUERY_URL = getattr( - settings, - "JQUERY_URL", - "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js", -) - URL_PREFIX = getattr(settings, "SMART_SELECTS_URL_PREFIX", "") @@ -31,21 +24,17 @@ def media(self): js = [] - if JQUERY_URL: - js.append(JQUERY_URL) - elif JQUERY_URL is not False: - vendor = "vendor/jquery/" - extra = "" if settings.DEBUG else ".min" + vendor = "" if django.VERSION < (1, 9, 0) else "vendor/jquery/" + extra = "" if settings.DEBUG else ".min" - jquery_paths = [ - "{}jquery{}.js".format(vendor, extra), - "jquery.init.js", - ] + jquery_paths = [ + "{}jquery{}.js".format(vendor, extra), + "jquery.init.js", + ] - if USE_DJANGO_JQUERY: - jquery_paths = ["admin/js/{}".format(path) for path in jquery_paths] + jquery_paths = ["admin/js/{}".format(path) for path in jquery_paths] - js.extend(jquery_paths) + js.extend(jquery_paths) media += Media(js=js) return media