Skip to content

Question validate_email( on model Field #14

@MayaKroft

Description

@MayaKroft

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions