I want to add an another autocomplete field to my model.form.
However, I get an wired template error I cannot make sense of. Do you have some ideas what I can do here?
Thank you very much! :)
error message:
AttributeError at /output/create/
'list' object has no attribute 'queryset'
Request Method: GET
Request URL: http://127.0.0.1:8000/output/create/
Django Version: 1.8.7
Exception Type: AttributeError
Exception Value:
'list' object has no attribute 'queryset'Error during template rendering In template /home/bjoern/Developement/Django/Outputmeldetool/venv_outputmeldetool/lib/python3.5/site-packages/crispy_forms/templates/bootstrap3/field.html, error at line 28 28 {% if field|is_checkbox and form_show_labels %}
```
class TestPublikationForm(forms.ModelForm):
class Meta:
model = KombiPublikation
exclude = ['pub_sprache']
widgets = {
'projektnummer': autocomplete.ModelSelect2(url='output:projekt-form-autocomplete'),
}
template.html
{{ form }}
```
error:
Exception Value: 'list' object has no attribute 'queryset'
Thank you! :)
I solved the issue myself by simply using
autocomplete.Select2
instead of autocomplete.ModelSelect2 - makes sense and shame on me :)
~This issue shouldn't be closed, I think, because ModelSelect2 is still broken for the reason reported, and it's mentioned explicitly in the documentation as the widget to use.~
I've read the linked issue #790 which contained the nugget of information I needed, that ModelSelect2 will only work over a form.ModelChoiceField, which I wasn't using for reasons involving a legacy database with questionable design decisions :)
Most helpful comment
I solved the issue myself by simply using
autocomplete.Select2
instead of autocomplete.ModelSelect2 - makes sense and shame on me :)