sdi/forms.py
changeset 21 3d7a52d9ed2e
parent 20 9db4ee082d4e
child 24 f79be1dd4a22
equal deleted inserted replaced
20:9db4ee082d4e 21:3d7a52d9ed2e
     8 
     8 
     9     topics_interested = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=TOPICS_CHOICES, required=False)
     9     topics_interested = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=TOPICS_CHOICES, required=False)
    10     class Meta:
    10     class Meta:
    11         model = Registrant
    11         model = Registrant
    12 
    12 
       
    13     def clean_email(self):
       
    14         """ See if the user has already registered using the email.
       
    15         """
       
    16 
       
    17         email = self.cleaned_data['email'].strip()
       
    18         try:
       
    19             Registrant.objects.get(email__iexact=email)
       
    20             raise forms.ValidationError("This email is already registered. Did you register earlier??")
       
    21         except Registrant.DoesNotExist:
       
    22             return email
       
    23 
    13     def clean_topics_interested(self):
    24     def clean_topics_interested(self):
    14         """ Join the choices using PIPE character and store them.
    25         """ Join the choices using PIPE character and store them.
    15         """
    26         """
    16 
    27 
    17         topics = self.cleaned_data['topics_interested']
    28         topics = self.cleaned_data['topics_interested']