Advertisement
MartinYanchev-99

forms.py

Oct 11th, 2020 (edited)
2,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. class SolveExercise(forms.Form):
  2.     CHOICES=[('opt_1',Exercise.opt_1),
  3.                     ('opt_2',Exercise.opt_2),
  4.                     ('opt_3',Exercise.opt_3),
  5.                     ('opt_4',Exercise.opt_4)]
  6.     choices = forms.ChoiceField(choices = CHOICES,widget = forms.RadioSelect() )
  7.  
  8.     class Meta:
  9.         model = Exercise
  10.         fields = ['choices']
  11.     def __init__(self, *args, **kwargs):
  12.         super(forms.Form, self).__init__(*args, **kwargs)
  13.  
  14.     def clean(self):
  15.         cleaned_data = super(forms.Form, self).clean()
  16.         return cleaned_data
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement