Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django choicefield empty label

### forms.py
from django.forms import Form, ChoiceField

CHOICE_LIST = [
    ('', '----'), # replace the value '----' with whatever you want, it won't matter
    (1, 'Rock'),
    (2, 'Hard Place')
]

class SomeForm (Form):

    some_choice = ChoiceField(choices=CHOICE_LIST, required=False)
Comment

PREVIOUS NEXT
Code Example
Python :: cmd to get ip address python 
Python :: jupyterlab interactive plot 
Python :: while input is not empty python 
Python :: a sigmoid function 
Python :: atan2 of number python 
Python :: python list files in directory 
Python :: Check np.nan value 
Python :: python concatenation 
Python :: convert list of lists to numpy array matrix python 
Python :: dbutils.widgets.get 
Python :: imagefield django models 
Python :: pandas selection row/columns 
Python :: python byte like to string 
Python :: python write into file at position 
Python :: add a tuple to a dictionary python 
Python :: python remove by index 
Python :: how to convert float to string in python 
Python :: python index of lowest value in list 
Python :: discord.py permissions 
Python :: optimize images using pillow 
Python :: palindrome checker python 
Python :: channel hide command in discord.py 
Python :: how to remove role discord bot python 
Python :: pickled list 
Python :: free download django app for windows 10 
Python :: Use a callable instead, e.g., use `dict` instead of `{}` 
Python :: function in the input function python 
Python :: python dataframe calculate difference between columns 
Python :: rename colums dataframe pandas 
Python :: python while loop break 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =