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
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
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
def age(self): """Return age in complete years.""" if self.birth_date: return get_age(self.birth_date) else: return None
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