django-autocomplete-light error = 'list' object has no attribute 'queryset'

后端 未结 3 1337
忘了有多久
忘了有多久 2021-01-03 10:29

i am new on django and i need your help, trying since many days to understand django-autocomplete-light, after setup my test, http://192.168.0.108:8000/country-autocomplete/

3条回答
  •  天涯浪人
    2021-01-03 10:55

    I had the same issue. The problem here is with the widget. Tried to fix it for very long. The only way in worked for me was changing form's widget.

    If it doesn't matter that much you can use autocomplete.ListSelect2 instead, it worked for me.

    So try this:

    class Form_country(forms.ModelForm):
        class Meta:
           model = Country
           fields = ('name', 'code2l')
           widgets = {
              'name': autocomplete.ListSelect2(
                'country-autocomplete'
               )
           }
    

    Actually you can just try any other autocomplete widget and see weather it works

提交回复
热议问题