Skip to content

Commit

Permalink
Remove jQuery settings
Browse files Browse the repository at this point in the history
  • Loading branch information
leibowitz committed Apr 28, 2020
1 parent 2d92a84 commit 97b98a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 28 deletions.
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Contents
:numbered: 1

installation
settings
usage


Expand Down
2 changes: 0 additions & 2 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@
url(r'^chaining/', include('smart_selects.urls')),
)
```

3. 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`.
10 changes: 0 additions & 10 deletions docs/settings.md

This file was deleted.

23 changes: 8 additions & 15 deletions smart_selects/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,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", "")


Expand All @@ -32,21 +29,17 @@ def media(self):

js = []

if JQUERY_URL:
js.append(JQUERY_URL)
elif JQUERY_URL is not False:
vendor = '' if django.VERSION < (1, 9, 0) else '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
Expand Down

0 comments on commit 97b98a8

Please sign in to comment.