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:
- [Django]-OperationalError: (2019, ""Can't initialize character set utf8mb4 (path: C:\\mysql\\\\share\\charsets\\)"")
- [Django]-'WSGIRequest' object has no attribute 'get' when executing form.is_valid()
- [Django]-How to run django app binded with gunicorn?
Source:stackexchange.com