Browse Source

Replace DataRequired with InputRequired, add CatchBunnyForm

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

19
app/main/forms.py

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
from flask_wtf import FlaskForm
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 app.models import Objective
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 = DateTimeField(id='datetimepicker_start', format="%d-%m-%Y %H:%M")
end_time_disabled = BooleanField('No end time')
@ -41,15 +41,20 @@ class ObjectiveForm(FlaskForm): @@ -41,15 +41,20 @@ class ObjectiveForm(FlaskForm):
raise ValidationError('Please use a different name.')
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')
class PlayerAddForm(FlaskForm):
name = StringField('Username', validators=[DataRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[DataRequired()])
name = StringField('Username', validators=[InputRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[InputRequired()])
submit_add = SubmitField('Create')
class UserCreateForm(FlaskForm):
name = StringField('Username', validators=[DataRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[DataRequired()])
name = StringField('Username', validators=[InputRequired(), Length(min=0, max=64)])
role = SelectField('Player Role', choices=[('none', 'none'), ('owner', 'owner'), ('hunter', 'hunter'), ('bunny', 'bunny')], validators=[InputRequired()])
submit_create = SubmitField('Create')
class CatchBunnyForm(FlaskForm):
bunny = SelectField('Bunny Name', coerce=int, validators=[InputRequired()])
#photo
submit = SubmitField('Send')

Loading…
Cancel
Save