tmpl-fastapi/app/forms/users.py
2023-02-20 12:09:43 +04:00

27 lines
650 B
Python

from starlette_wtf import StarletteForm
from wtforms import IntegerField
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired
from wtforms.validators import NumberRange
class AddUserForm(StarletteForm):
pswd = PasswordField('Admin password (1234)')
email = StringField(
label='User\'s e-mail',
validators=[DataRequired()],
)
name = StringField(
label='User\'s full name',
validators=[DataRequired()],
)
age = IntegerField(
label='User\'s age',
validators=[
DataRequired(),
NumberRange(0, 200),
],
)