Guest User

Select Widget

a guest
Jul 4th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. class AnswerChoiceForm(forms.Form):
  2.  
  3.     CHOICES = (
  4.         (None, None),
  5.         (1, 'Disagree strongly'),
  6.         (2, 'Disagree a little'),
  7.         (3, 'Neither agree nor disagree'),
  8.         (4, 'Agree a little'),
  9.         (5, 'Agree strongly'),
  10.  
  11.     )
  12.     answer_choice = forms.ChoiceField(
  13.         widget=forms.Select(
  14.             attrs={'class': 'form-control', 'style': 'width: 270px;'}
  15.         ),
  16.         choices=CHOICES,
  17.         validators=[none_choice_validator],
  18.         required=True
  19.     )
  20.  
  21.     class Meta:
  22.         fields = ['answer_choice']
Add Comment
Please, Sign In to add comment