Sep-05-2020, 10:04 AM
I've been learning django for two weeks now and I'm currently learning raising forms.Errors such as forms.ValidationError.
Here's the code I've written:
Here's the code I've written:
def clean_email(self, *args, **kwargs): email = self.cleaned_data.get('email') if not email.endswith("gmail.com"): raise forms.ValidationError("This is not a valid email") return emailThe problem I have is when I write an email that doesn't contain gmail.com, ValidationError doesn't get printed in the web.