forcing first name to have at least one character in user form
This commit is contained in:
@@ -987,6 +987,14 @@ class UserForm(ModelForm):
|
|||||||
model = User
|
model = User
|
||||||
fields = ['first_name','last_name','email']
|
fields = ['first_name','last_name','email']
|
||||||
|
|
||||||
|
def clean_first_name(self):
|
||||||
|
first_name = self.cleaned_data.get('first_name')
|
||||||
|
|
||||||
|
if len(first_name):
|
||||||
|
return first_name
|
||||||
|
|
||||||
|
raise forms.ValidationError('Please fill in your first name')
|
||||||
|
|
||||||
def clean_email(self):
|
def clean_email(self):
|
||||||
email = self.cleaned_data.get('email')
|
email = self.cleaned_data.get('email')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user