Closed wchesley closed 3 years ago
So after more stumbling around, I figured this out...I was under the impression that {{ form.media }}
would bring in all the required scripts, but this was not the case. Instead I compared the HTML of the admin form to that of my user facing form and manually added in the scripts.
Scripts I added are as follows:
<script src="/admin/jsi18n/"></script>
<link href="/staticfiles/admin/css/vendor/select2/select2.css" type="text/css" media="screen" rel="stylesheet">
<link href="/staticfiles/admin/css/autocomplete.css" type="text/css" media="screen" rel="stylesheet">
<link href="/staticfiles/autocomplete_light/select2.css" type="text/css" media="screen" rel="stylesheet">
<script src="/staticfiles/admin/js/vendor/select2/select2.full.js"></script>
<script src="/staticfiles/admin/js/jquery.init.js"></script>
<script src="/staticfiles/autocomplete_light/autocomplete_light.js"></script>
<script src="/staticfiles/autocomplete_light/select2.js"></script>
Marking this issue as closed.
Bumping this, it was the reason I couldn't get django_filters to work.
I've got Autocomplete working on the admin page, using the same form I'm having issues with, in the user-facing page. The TaggitSelect2 in the user-facing page is being rendered as a select box, that is blank, with no ability to input text. On the admin page, I have the ability to input text, and autocomplete works as expected.
Here's my code:
Model:
Form:
Url:
Template:
Rendered template picture: Rendered template code:
Any ideas as to where I'm going wrong with this?