Browse Source

Replace DataRequired with InputRequired, add CatchBunnyForm

testing
Burathar 5 years ago
parent
commit
7ff8023442
  1. 19
      app/main/forms.py

19
app/main/forms.py

@ -1,11 +1,11 @@
from flask_wtf import FlaskForm from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, DateTimeField, BooleanField, HiddenField, FloatField, SelectField from wtforms import StringField, SubmitField, DateTimeField, BooleanField, HiddenField, FloatField, SelectField
from wtforms.validators import DataRequired, ValidationError, Length, NumberRange from wtforms.validators import InputRequired, DataRequired, ValidationError, Length, NumberRange
from pytz import timezone from pytz import timezone
from app.models import Objective from app.models import Objective
class CreateGameForm(FlaskForm): class CreateGameForm(FlaskForm):
game_name = StringField('Game Name', validators=[DataRequired(), Length(min=0, max=64)]) game_name = StringField('Game Name', validators=[InputRequired(), Length(min=0, max=64)])
start_time_disabled = BooleanField('No start time') start_time_disabled = BooleanField('No start time')
start_time = DateTimeField(id='datetimepicker_start', format="%d-%m-%Y %H:%M") start_time = DateTimeField(id='datetimepicker_start', format="%d-%m-%Y %H:%M")
end_time_disabled = BooleanField('No end time') end_time_disabled = BooleanField('No end time')
@ -41,15 +41,20 @@ class ObjectiveForm(FlaskForm):
raise ValidationError('Please use a different name.') raise ValidationError('Please use a different name.')
class PlayerUpdateForm(FlaskForm): class PlayerUpdateForm(FlaskForm):
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[DataRequired()]) role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[InputRequired()])
submit = SubmitField('Update') submit = SubmitField('Update')
class PlayerAddForm(FlaskForm): class PlayerAddForm(FlaskForm):
name = StringField('Username', validators=[DataRequired(), Length(min=0, max=64)]) name = StringField('Username', validators=[InputRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[DataRequired()]) role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[InputRequired()])
submit_add = SubmitField('Create') submit_add = SubmitField('Create')
class UserCreateForm(FlaskForm): class UserCreateForm(FlaskForm):
name = StringField('Username', validators=[DataRequired(), Length(min=0, max=64)]) name = StringField('Username', validators=[InputRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[DataRequired()]) role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[InputRequired()])
submit_create = SubmitField('Create') submit_create = SubmitField('Create')
class CatchBunnyForm(FlaskForm):
bunny = SelectField('Bunny Name', coerce=int, validators=[InputRequired()])
#photo
submit = SubmitField('Send')

Loading…
Cancel
Save