django-autocomplete-light
django-autocomplete-light copied to clipboard
Javascript error : `yl.getForwards is not a function`
Using dal and dal_select2 inside the admin, without custom or third-party JS (django 2.0.3 and dal 3.3.0rc6) yields the following error when clicking on the autocompleted text widget:
select2.js:45 Uncaught TypeError: yl.getForwards is not a function
at n.fn.init.data (select2.js:45)
at d.query (select2.full.min.js:1)
at e.<anonymous> (select2.full.min.js:1)
at e.d.invoke (select2.full.min.js:1)
at e.d.trigger (select2.full.min.js:1)
at e.trigger (select2.full.min.js:1)
at e.open (select2.full.min.js:1)
at e.toggleDropdown (select2.full.min.js:1)
at d.<anonymous> (select2.full.min.js:1)
at d.invoke (select2.full.min.js:1)
And the autocompletion does not work.
Does this have something to do with #981 ?
I don't know, but while it doesn't work in production, it works in "developpment" mode, using python3 manage.py runserver. The difference being that in dev mode, non-minified versions of jquery and select2 are loaded (vs. minified versions in production).
Can you try with master ? It uses the same medias as django.contrib.admin in django 2
I had the same problem, and it was resolved by running the collectstatic script again in prod.
I got this error trying to use https://github.com/shamanu4/dal_admin_filters/
That code relied that DAL should provide "select2.full.js" and "select2.css": https://github.com/shamanu4/dal_admin_filters/blob/5476befb8f1f7188a733a65257180d74a2c511e2/dal_admin_filters/init.py#L28
'autocomplete_light/vendor/select2/dist/js/select2.full.js'
'autocomplete_light/vendor/select2/dist/css/select2.css'
but I found that DAL does not provide it now (should it? Who should?).
I found these "dist/js/select2.full.js" + "select2.css" under
django/contrib/admin/static/admin/js/vendor/
but then I change inclusion to
'admin/js/vendor/select2/select2.full.js',
or
'admin/js/vendor/select2/select2.full.min.js',
I got this error.
Who should provide and include static files with "vendor/select2/select2.****.js"? DAL? dal_select2? ...
I'm also having this issue. This was working fine until I updated to Django 2.0+
@belonesox django.contrib.admin in version 2 should provide the scripts.
@selected-pixel-jameson do you have django.contrib.admin in INSTALLED_APPS ?
@jpic Sorry for the very delayed response. Yes. I do have django.contrib.admin in INSTALLED_APPS.
Try to add js media
'//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js',
'autocomplete_light/jquery.init.js',
'vendor/select2/dist/js/select2.full.js',
'vendor/select2/dist/js/i18n/en.js',
'autocomplete_light/autocomplete.init.js',
'autocomplete_light/forward.js',
'autocomplete_light/select2.js',
'autocomplete_light/jquery.post-setup.js',
I don't believe I'm seeing this error anymore.