Custom validation entire form-16
custom validation entire form
1.sob same thakbe sudhu change hobe forms.py er banano function a
from django import forms
class Students(forms.Form):
name=forms.CharField()
email=forms.EmailField()
def clean(self):
cleaned_data = super().clean()
valname=self.cleaned_data['name']
valemail=self.cleaned_data['email']
if len(valname)<4:
raise forms.ValidationError("Name should be more than 4 character")
if len(valemail)<10:
raise forms.ValidationError("EMail should be more then 10 character")
Comments
Post a Comment