28 lines
650 B
Python
28 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),
|
||
|
],
|
||
|
)
|