-
Notifications
You must be signed in to change notification settings - Fork 1
/
forms.py
40 lines (33 loc) · 1.38 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextField, RadioField, TextAreaField, SelectField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length
### change the following tuples accordingly to your application ticket needs
ticket_app = ([
( '1', 'Server' ),
( '2', 'Local' )
])
ticket_arg = ([
( '1', 'Development (code)' ),
( '2', 'Deploy (code)' ),
( '3', 'Bugs (code)' ),
( '4', 'Bugs (front-end)' ),
( '5', 'Improvement Suggestion' ),
( '6', 'Other' )
])
urgency_choices = ([
( '1', 'Low' ),
( '2', 'Medium' ),
( '3', 'High' )
])
### these are the Forms actually imported
class TicketForm(FlaskForm):
title = StringField('Title', validators=[DataRequired(), Length(min=1, max=250)])
body = TextAreaField('Body', validators=[DataRequired(), Length(min=1, max=4000)])
urgency = RadioField('Urgency', choices=urgency_choices, validators=[DataRequired()] )
application = RadioField('Application', choices=ticket_app, validators=[DataRequired()])
argument = SelectField('Argument', choices=ticket_arg, validators=[DataRequired()])
submit = SubmitField('Submit')
class TicketReplyForm(FlaskForm):
body = TextAreaField('Update')
follow = BooleanField('Follow Ticket Updates (e-mail)')
submit = SubmitField('Update')