Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added select widget for bs4 form #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions bootstrap4/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ class MessageForm(forms.Form):
help_text="help on a inline_checkboxes",
)

select_field = forms.ChoiceField(
choices=(
('bird',
"it's a bird"),
('plane',
"it's a plane"),
('dunno',
"it's something else !")
),
widget=forms.Select,
initial='option_two',
help_text="help on a Select",
)

grouped_checkboxes = forms.MultipleChoiceField(
choices=(
('Group 1',
Expand Down Expand Up @@ -144,6 +158,7 @@ class MessageForm(forms.Form):
InlineRadios('inline_radio_buttons'),
Field('checkboxes', style="background: #FAFAFA"),
InlineCheckboxes('inline_checkboxes'),
'select_field',
AppendedText('appended_text', '.00'),
AppendedText('appended_text2', '.00', css_class='form-control-lg'),
AppendedText('appended_select', '.00'),
Expand Down Expand Up @@ -229,6 +244,21 @@ class HorizontalMessageForm(forms.Form):
help_text="help on a inline_checkboxes",
)

select_field = forms.ChoiceField(
choices=(
('bird',
"it's a bird"),
('plane',
"it's a plane"),
('dunno',
"it's something else !")
),
widget=forms.Select,
initial='option_two',
help_text="help on a Select",
)


appended_text = forms.CharField(
help_text="Here's more help text"
)
Expand Down Expand Up @@ -264,6 +294,7 @@ class HorizontalMessageForm(forms.Form):
InlineRadios('inline_radio_buttons'),
Field('checkboxes', style="background: #FAFAFA"),
InlineCheckboxes('inline_checkboxes'),
'select_field',
AppendedText('appended_text', '.00'),
AppendedText('appended_text2', '.00', css_class='form-control-lg'),
PrependedText('prepended_text',
Expand Down