Django-autocomplete-light: 'list' object has no attribute 'queryset' error

Created on 31 Oct 2016  路  2Comments  路  Source: yourlabs/django-autocomplete-light

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! :)

Most helpful comment

I solved the issue myself by simply using

autocomplete.Select2

instead of autocomplete.ModelSelect2 - makes sense and shame on me :)

All 2 comments

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Guilouf picture Guilouf  路  3Comments

Senpos picture Senpos  路  5Comments

dotmobo picture dotmobo  路  7Comments

luzfcb picture luzfcb  路  6Comments

Schnouki picture Schnouki  路  7Comments