django choicefield empty label

Solutions on MaxInterview for django choicefield empty label by the best coders in the world

showing results for - "django choicefield empty label"
Pearce
19 Oct 2018
1### forms.py
2from django.forms import Form, ChoiceField
3
4CHOICE_LIST = [
5    ('', '----'), # replace the value '----' with whatever you want, it won't matter
6    (1, 'Rock'),
7    (2, 'Hard Place')
8]
9
10class SomeForm (Form):
11
12    some_choice = ChoiceField(choices=CHOICE_LIST, required=False)