I have a website to validate spreadsheet headers and rows when a spreadsheet is uploaded to the site, here I have some validation function where I will have to validate the rows according the attributes of the field in my case I have model like below:
models.py
from phone_field.models import PhoneField
class Add(Model):
phone = PhoneField(max_length=255)
a_1 = models.CharField(max_length=255)
ad_2 = models.CharField(max_length=255)
town = models.CharField(max_length=255)
email = models.EmailField(unique=True)
I need to write the custom validators for phone and email while uploading the spreadsheet.
def phone_validator(value):
# code: ...
def email_validator(value):
# code: ...