-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for more than one autocomplete field. #5
Conversation
havocbane
commented
Apr 16, 2020
- Use a form prefix to make name and ID unique.
- Version bump to 0.1.5 (0.1.4 was static files change for Django 3.0)
* Django dropped 'staticfiles' in templates. Use 'static' instead.
… multiple autocomplete filters can be put on the page. Without this, all fields are named/IDed autocomplete_field and there's a collision.
Update version to acknowledge change
By specifying a prefix of the field's name on each Autocomplete form multiple autocomplete filters can be put on the page. Without this, all fields are named/IDed autocomplete_field and there's a collision.
… "endswith" jQuery selector, without that the field isn't found and a Javascript console error fires.
The field being named with the field name means we should be doing an "endswith" jQuery selector, without that the field isn't found and a Javascript console error fires.
I put the dollarsign in the wrong place. It should go on the field, n…
Hi @havocbane , I did not understand, "more than one autocomplete field" situation? It's already more than one field?
You have 3 different fields and widgets... Can you explain more if possible? |
@vigo thank you for your feedback; let me elaborate. We were seeing an issue where multiple fields would render with default Django form drop-downs instead of auto-complete (the last one in the list filter would always be an auto-complete). We were able to address this by adding the form prefix when instantiating the autocomplete form so that the elements would have unique names/IDs in the HTML. If this has not been your experience, it is certainly possible that things have changed in later Django versions. We have been using 3.0.5 (indeed, this pull request includes Django updates as well, e.g. static module loading). |
@havocbane with all due respect, can you please share code snippet? I'd like to produce this issue locally and try to understand better. |
Sure, I will try to get you a simple example to reproduce the issue next week. |
Update autocomplete select init to be compatible with django 3.2
Thanks @havocbane , I've picked JavaScript changes manually, others were fixed via @guglielmo 's PR... |