我想要在Django中選擇一個表單。我的表單代碼如下所示:如何更改Django ChoiceField中的默認選定選項?
UNIVERSITIES = (
('North South University', 'North South University'),
('BRAC University', 'BRAC University'),
)
class SearchForm(forms.Form):
"""
Form used to search for a professor.
"""
professor_name = forms.CharField(
label="Enter a professor's name or name code",
max_length=255,
widget=forms.TextInput(attrs={
'placeholder': 'Search for a professor',
'required' : 'required',
}),
)
university = forms.ChoiceField(
label="Select your university",
choices=UNIVERSITIES,
)
在形式得到「南北大學」默認。我如何將其更改爲空字符串?也就是說,沒有選項將被選中謝謝。