equal
deleted
inserted
replaced
1 from django import forms |
1 from django import forms |
2 |
2 |
3 from offline.event.models import Event |
3 from offline.event.models import Event, QUIZ_CHOICES |
|
4 from offline.quiz.models import TOPICS_CHOICES |
4 |
5 |
5 class EventCreateForm(forms.ModelForm): |
6 class EventCreateForm(forms.ModelForm): |
6 |
7 |
7 class Meta: |
8 class Meta: |
8 model = Event |
9 model = Event |
19 if start_date > stop_date: |
20 if start_date > stop_date: |
20 raise forms.ValidationError("Event cannot stop before it starts") |
21 raise forms.ValidationError("Event cannot stop before it starts") |
21 |
22 |
22 return self.cleaned_data['stop_date'] |
23 return self.cleaned_data['stop_date'] |
23 |
24 |
|
25 class OpenQuizForm(forms.Form): |
|
26 |
|
27 quiz_num = forms.ChoiceField(required=True, widget=forms.RadioSelect, choices=QUIZ_CHOICES) |
|
28 topics = forms.MultipleChoiceField(required=True, widget=forms.CheckboxSelectMultiple, choices=TOPIC_CHOICES,) |
|
29 |
|
30 def clean_topics(self): |
|
31 |
|
32 return self.cleaned_data["topics"] |