|
1
|
|
|
from flask_wtf import FlaskForm |
|
|
|
|
|
|
2
|
|
|
from wtforms.fields import StringField, PasswordField, IntegerField, FloatField, SubmitField |
|
3
|
|
|
from wtforms.validators import InputRequired, NumberRange |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
class LoginForm(FlaskForm): |
|
|
|
|
|
|
7
|
|
|
name = StringField(u'Username', validators=[InputRequired()]) |
|
8
|
|
|
password = PasswordField(u'Password', validators=[InputRequired()]) |
|
9
|
|
|
|
|
10
|
|
|
submit = SubmitField(u'Login') |
|
11
|
|
|
|
|
12
|
|
|
|
|
13
|
|
|
class CreateTaskForm(FlaskForm): |
|
|
|
|
|
|
14
|
|
|
task = StringField(u'Task', validators=[InputRequired()]) |
|
15
|
|
|
base_points = IntegerField(u'Base Points', validators=[NumberRange(1, 13, 'Value must be between 1 and 13')]) |
|
|
|
|
|
|
16
|
|
|
time_factor = FloatField(u'Time Factor', validators=[NumberRange(0.0, 3.0, 'Value must be between 0.0 and 3.0')]) |
|
|
|
|
|
|
17
|
|
|
# room = StringField(u'Room', validators=[InputRequired()]) |
|
18
|
|
|
|
|
19
|
|
|
submit = SubmitField(u'Create Task') |
|
20
|
|
|
|
|
21
|
|
|
|
|
22
|
|
|
class CustomTaskForm(FlaskForm): |
|
|
|
|
|
|
23
|
|
|
task = StringField(u'Custom Task', validators=[InputRequired()]) |
|
24
|
|
|
points = IntegerField(u'Points', validators=[NumberRange(1, 13, 'Value must be between 1 and 13')]) |
|
|
|
|
|
|
25
|
|
|
# room = StringField(u'Room', validators=[InputRequired()]) |
|
26
|
|
|
|
|
27
|
|
|
submit = SubmitField(u'Do Task now') |
|
28
|
|
|
|
The coding style of this project requires that you add a docstring to this code element. Below, you find an example for methods:
If you would like to know more about docstrings, we recommend to read PEP-257: Docstring Conventions.