def clean_email(self): """ Validate that the supplied email address is unique for the site. """ if RegistrationProfile.objects( email__iexact=self.cleaned_data['email']): raise forms.ValidationError(_(u'This email address is already in use. Please supply a different email address.')) return self.cleaned_data['email']
def clean_username(self): """ Validate that the username is alphanumeric and is not already in use. """ if RegistrationProfile.objects( username__iexact=self.cleaned_data['username']): raise forms.ValidationError( _(u'This username is already taken. Please choose another.')) return self.cleaned_data['username']