Add clean_name method for BillingAddressFormSignup

This commit is contained in:
PCoder 2019-12-18 22:54:10 +05:30
parent e46729ee04
commit ddd90e650b
1 changed files with 8 additions and 0 deletions

View File

@ -175,6 +175,14 @@ class BillingAddressFormSignup(BillingAddressForm):
except CustomUser.DoesNotExist:
return email
def clean_name(self):
name = self.cleaned_data.get('name')
try:
validate_name(name)
except ValidationError as ve:
raise forms.ValidationError(_("Improper Name"))
return name
class UserBillingAddressForm(forms.ModelForm):
user = forms.ModelChoiceField(queryset=CustomUser.objects.all(),