peewee-validates icon indicating copy to clipboard operation
peewee-validates copied to clipboard

Question validate_email( on model Field

Open MayaKroft opened this issue 3 years ago • 0 comments

I am not very experienced with peewee_validates, I was reading through the documentation and couldn't fully understand validation inside a model class, it seems you can only apply a validator to the whole class, is it possible to inside a model call to apply a validator to just one field? particularly a validate_email?

`class User(Model): name = CharField(max_length=60) address = CharField() email = CharField(validator=validate_email()) billing = CharField()

class Meta:
    constraints = [SQL('UNIQUE("name" COLLATE NOCASE, "email" COLLATE NOCASE)')]
    database = db`

something like that to maybe combine with constraints? I am sorry if it is a stupid question, I am still studying how to use databases.

MayaKroft avatar Feb 01 '23 13:02 MayaKroft