Example #1
0
 def clean(self):
     birth_date = self.cleaned_data.get('birth_date', None)
     if birth_date:
         age = get_age(birth_date)
         if age < self.min_age:
             raise forms.ValidationError(_(u"We're sorry. Based on the information you have submitted to us, you are ineligible to participate in this campaign."))
     return self.cleaned_data
Example #2
0
 def clean(self):
     dob = self.cleaned_data.get('birth_date', None)
     if dob and get_age(dob) < settings.CAMPAIGN_MIN_AGE_RANGE[0]:
         raise forms.ValidationError(
             _(u'''We're sorry. Based on the information you have submitted to us, you are ineligible to participate on this site. 
         Please send an email to [email protected] to cancel your account.'''
               ))
     return self.cleaned_data
Example #3
0
 def clean(self):
     birth_date = self.cleaned_data.get('birth_date', None)
     if birth_date:
         age = get_age(birth_date)
         if age < self.min_age:
             raise forms.ValidationError(
                 _(u"We're sorry. Based on the information you have submitted to us, you are ineligible to participate in this event."
                   ))
     return self.cleaned_data
Example #4
0
 def age(self):
     """Return age in complete years."""
     if self.birth_date:
         return get_age(self.birth_date)
     else:
         return None
Example #5
0
 def clean(self):
     dob = self.cleaned_data.get('birth_date', None)
     if dob and get_age(dob) < settings.CAMPAIGN_MIN_AGE_RANGE[0]:
         raise forms.ValidationError(_(u'''We're sorry. Based on the information you have submitted to us, you are ineligible to participate on this site. 
         Please send an email to [email protected] to cancel your account.'''))
     return self.cleaned_data