forked from timonweb/django-bulma
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
28 lines (25 loc) · 860 Bytes
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from django import forms
COLOR_CHOICES = (
('red', 'Red'),
('green', 'Green'),
('blue', 'Blue')
)
class FormExample(forms.Form):
text = forms.CharField()
email = forms.EmailField()
number = forms.CharField(widget=forms.NumberInput())
url = forms.CharField(widget=forms.URLInput())
password = forms.CharField(widget=forms.PasswordInput())
select = forms.ChoiceField(choices=COLOR_CHOICES)
multi_select = forms.MultipleChoiceField(choices=COLOR_CHOICES)
textarea = forms.CharField(widget=forms.Textarea())
checkbox = forms.BooleanField()
checkboxes = forms.MultipleChoiceField(
choices=COLOR_CHOICES,
widget=forms.CheckboxSelectMultiple()
)
radios = forms.ChoiceField(
choices=COLOR_CHOICES,
widget=forms.RadioSelect()
)
file = forms.FileField(required=True)