I am trying to raise ValidationError through validators.py
or def clean(self)
on an email field in the Django model to know if an email exists in the DB.
Below is a brief of my model:
class Profile(models.Model)
...
email = models.EmailField()
...
def __str__(self)
return self.f_name
I know I can add unique=True
to the model field to ensure that, or simply do a cleaned_data
in forms, but the solution I want is that of validator.py
or def clean(self)
in models.py
.