Commit 6b63c54
committed
Fix jQuery preference order to prevent conflicts with third-party widgets
When other Django admin widgets (like PrettyJSONWidget, JSONEditor, etc.)
load their own jQuery, they overwrite the global `jQuery` variable. Since
django_select2.js prefers `jQuery` over `window.django.jQuery`, it ends up
using the newly loaded jQuery instance which doesn't have Select2 attached.
This causes "$element.select2 is not a function" errors on admin pages.
By preferring `window.django.jQuery` (Django's protected instance), we ensure
Select2 functionality works regardless of what other widgets do to the global
jQuery variable.1 parent f5c68cd commit 6b63c54
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments