tmpl-fastapi/app/forms/users.py

28 lines
650 B
Python
Raw Normal View History

2023-02-20 12:09:43 +04:00
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),
],
)