event/forms.py
changeset 62 baddb55f8da7
parent 12 81cd0140a0f2
child 63 21cdadb1b98e
equal deleted inserted replaced
61:3b8b0ce51566 62:baddb55f8da7
     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"]