[Django]-Django widget for a dropdown list

6👍

We need to use forms.Select()

class Meta:
    model=someForm
    fields=['Dropdown']
    widgets = {
      'Dropdown': forms.Select(attrs={'id':'choicewa'}),
      }

5👍

The place you marked by ??? is for specifying Field class. If you want to specify proper field class you should use forms.ChoiceField.

Detailed information on widgets and fields:

Leave a comment