Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question validate_email( on model Field #14

Open
MayaKroft opened this issue Feb 1, 2023 · 0 comments
Open

Question validate_email( on model Field #14

MayaKroft opened this issue Feb 1, 2023 · 0 comments

Comments

@MayaKroft
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant