You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PCv5/app/forms/poll.py

39 lines
928 B

from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.fields.html5 import DateTimeField
from wtforms.validators import InputRequired, Optional
from datetime import datetime, timedelta
class PollForm(FlaskForm):
title = StringField(
'Question',
validators=[
InputRequired(),
]
)
choices = TextAreaField(
'Choix (un par ligne)',
validators=[
InputRequired(),
# TODO: add a validator to check if there is at least one choice
]
)
start = DateTimeField(
'Début',
default=datetime.now(),
validators=[
Optional()
]
)
end = DateTimeField(
'Fin',
default=datetime.now() + timedelta(days=1),
validators=[
Optional()
]
)
submit = SubmitField(
'Créer le sondage'
)