yourlabs / django-autocomplete-light

A fresh approach to autocomplete implementations, specially for Django. Status: v4 alpha, v3 stable, v2 & v1 deprecated.
https://django-autocomplete-light.readthedocs.io
MIT License
1.8k stars 467 forks source link

Multiple Choice Field content not showing when the page is reloaded #473

Open pfremp opened 9 years ago

pfremp commented 9 years ago

I have an autocomplete Multiple Choice Field in my form.

The form works fine in the sense that the choices are saved to the DB (as a char string: [u'French', u'English']).

The problem is when I return to the page, to view the saved details and update, the model choice options are not showing.

I also make used of a single choice field, which works fine. However, the options for the multiple choice field are not showing when the page is reloaded.

Does anyone know what the issue is? Please see info below and images attached.

More info:

autocomplete_light_registry.py: ... # languages autocomplete class OsAutocomplete(al.AutocompleteListBase): choices = ['English', 'French', 'Spanish', 'German', 'Mandarin', 'Cantonese', 'Italian', 'Portugese'] al.register(OsAutocomplete) forms.py ... lang = autocomplete_light.MultipleChoiceField('OsAutocomplete', required=False, label='Languages') ... class Media: """ We're currently using Media here, but that forced to move the javascript from the footer to the extrahead block ... ``` So that example might change when this situation annoys someone a lot. """ js = ('js/dependant_autocomplete.js',) ``` ![form_when_page_is_reloaded language values missing](https://cloud.githubusercontent.com/assets/6531222/9110444/9d3a5b4c-3c35-11e5-8e2c-f69ec58bba56.png) ![admin_view](https://cloud.githubusercontent.com/assets/6531222/9110445/9d3f9a3a-3c35-11e5-93c1-f638b9ccb8d4.png) ![form_when_submitting_info](https://cloud.githubusercontent.com/assets/6531222/9110446/9d470fae-3c35-11e5-8169-3271bb1b65b6.png) Many thanks

jpic commented 9 years ago

I couldn't reproduce this in the test project.

We're currently using Media here, but that forced to move the javascript from the footer to the extrahead block

That's weird.

jpic commented 9 years ago

https://django-autocomplete-light.readthedocs.org/en/master/faq.html#how-to-ask-for-help