gcp-hockey-results/forms.py
Jonny Ervine 1ffa319b1e new file: app.py
new file:   appengine_config.py
	new file:   dbWrite.py
	new file:   forms.py
	new file:   main.py
	new file:   readSettings.py
	new file:   requirements.txt
	new file:   routes/__init__.py
	new file:   routes/_convenor.py
	new file:   routes/_hkfcD_motm.py
	new file:   routes/_matches.py
	new file:   routes/_search.py
	new file:   routes/dashboard.py
	new file:   static/css/bootstrap-theme.css
	new file:   static/css/bootstrap-theme.css.map
	new file:   static/css/bootstrap-theme.min.css
	new file:   static/css/bootstrap-theme.min.css.map
	new file:   static/css/bootstrap.css
	new file:   static/css/bootstrap.css.map
	new file:   static/css/bootstrap.min.css
	new file:   static/css/bootstrap.min.css.map
	new file:   static/css/dashboard.css
	new file:   static/css/dashboard.css.orig
	new file:   static/fonts/glyphicons-halflings-regular.eot
	new file:   static/fonts/glyphicons-halflings-regular.svg
	new file:   static/fonts/glyphicons-halflings-regular.ttf
	new file:   static/fonts/glyphicons-halflings-regular.woff
	new file:   static/fonts/glyphicons-halflings-regular.woff2
	new file:   static/js/bootstrap.js
	new file:   static/js/bootstrap.min.js
	new file:   static/js/dashboard.js
	new file:   static/js/npm.js
	new file:   tables.py
	new file:   templates/_about.html
	new file:   templates/_clubPlayingRecordResults.html
	new file:   templates/_clubPlayingRecords.html
	new file:   templates/_convenorClubAdd.html
	new file:   templates/_convenorClubAddResults.html
	new file:   templates/_convenorClubList.html
	new file:   templates/_convenorEditPlayerResults.html
	new file:   templates/_convenorEditSquadList.html
	new file:   templates/_convenorEditSquadListTeamSelect.html
	new file:   templates/_convenorFixtureList.html
	new file:   templates/_convenorPlayerAdd.html
	new file:   templates/_convenorPlayerAddResults.html
	new file:   templates/_convenorPlayerDbCreate.html
	new file:   templates/_convenorPlayerDbCreateResults.html
	new file:   templates/_convenorPlayerEdit.html
	new file:   templates/_convenorSquadList.html
	new file:   templates/_convenorSquadListResults.html
	new file:   templates/_convenorTeamAdd.html
	new file:   templates/_convenorTeamAddResults.html
	new file:   templates/_error.html
	new file:   templates/_goalsAssistsAdmin.html
	new file:   templates/_hkfcDAdminThanks.html
	new file:   templates/_hkfcDGoalsThanks.html
	new file:   templates/_hkfcDMatchComments.html
	new file:   templates/_hkfcDMatchSquad.html
	new file:   templates/_hkfcDMatchSquadReset.html
	new file:   templates/_hkfcDMatchSquadSelected.html
	new file:   templates/_hkfcDMotmAdmin.html
	new file:   templates/_hkfcDMotmVote.html
	new file:   templates/_hkfcDPlayerRemoved.html
	new file:   templates/_hkfcDPotYChart.html
	new file:   templates/_hkfcDVoteChart.html
	new file:   templates/_hkfcDVoteThanks.html
	new file:   templates/_hkfcPlayerDeleted.html
	new file:   templates/_matchDetails.html
	new file:   templates/_playerCheck.html
	new file:   templates/_playerCheckResults.html
	new file:   templates/_playerRecordResults.html
	new file:   templates/_playerRecords.html
	new file:   templates/_search.html
	new file:   templates/_searchResults.html
	new file:   templates/_teamRecordResults.html
	new file:   templates/_teamRecords.html
	new file:   templates/dashboard.html
	new file:   templates/results.html
	new file:   templates/search.html
Initial commit
2020-02-19 06:58:08 +00:00

127 lines
6.3 KiB
Python

#import MySQLdb
import pymysql
import os
from app import app
from flask_wtf import FlaskForm
from wtforms import BooleanField, StringField, PasswordField, TextField, IntegerField, TextAreaField, SubmitField, RadioField, SelectField
from wtforms.fields.html5 import DateField
from wtforms_components import read_only
from wtforms import validators, ValidationError
from wtforms.validators import InputRequired, Email, Length
from readSettings import mySettings
from flask_bootstrap import Bootstrap
from datetime import datetime
#from dbWrite import read_cloudsql, sql_read, sql_read_static
class LoginForm(FlaskForm):
username = StringField('username', validators=[InputRequired(), Length(min=4, max=15)])
password = PasswordField('password', validators=[InputRequired(), Length(min=4, max=80)])
remember = BooleanField('remember me')
class RegisterForm(FlaskForm):
email = StringField('email', validators=[InputRequired(), Email(message='Invalid email'), Length(max=50)])
username = StringField('username', validators=[InputRequired(), Length(min=4, max=15)])
password = PasswordField('password', validators=[InputRequired(), Length(min=8, max=80)])
class addPlayerForm(FlaskForm):
playerClub = SelectField('Club:', choices=[])
playerTeam = SelectField('Team:', choices=[])
playerForenames = TextField('Forenames:')
playerSurnames = TextField('Surname:')
playerNickname = TextField('Nickname')
playerChineseName = TextField('Chinese Name:')
playerEmailAddress = TextField('Email Address:')
playerDob = DateField('Date of Birth:', default=datetime.today, format='%Y-%m-%d')
playerHkid = TextField('HKID Number:')
playerNumber = TextField('Shirt Number:')
playerTelNumber = TextField('Player Contact Number:')
submit = SubmitField('Submit')
class addTeamForm(FlaskForm):
clubName = SelectField("Club of team entry to create", coerce=str)
teamName = TextField("Team table to create (e.g. A, B, C, etc.)", validators=[InputRequired(), Length(max=1)])
submit = SubmitField("Submit")
class addClubForm(FlaskForm):
clubName = TextField("Name of the Hockey Club to add")
submit = SubmitField("Submit")
class playerDbCreateForm(FlaskForm):
clubName = SelectField("Name of the Hockey Club to create player database for")
year = SelectField("Season start year")
submit = SubmitField("Submit")
class searchForm(FlaskForm):
seasonStart = datetime.strptime('2018-09-01', '%Y-%m-%d')
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
clubName = SelectField("Club to search", choices=[], coerce=str)
teamName = SelectField("Select a Team", choices=[])
startDate = DateField('DatePicker', format='%Y-%m-%d', default=seasonStart)
endDate = DateField('DatePicker', format='%Y-%m-%d', default=datetime.today())
submitButton = SubmitField("Submit")
class playerRecordsForm(FlaskForm):
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
clubName = SelectField("Club to search", choices=[], coerce=str)
teamName = SelectField("Select a Team", choices=[])
submitButton = SubmitField("Submit")
class teamRecordsForm(FlaskForm):
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
clubName = SelectField("Club to search", choices=[], coerce=str)
teamName = SelectField("Select a Team", choices=[])
submitButton = SubmitField("Submit")
class clubPlayingRecordsForm(FlaskForm):
season = SelectField('Season data to search', choices=[('2019', '2019/20'), ('2018', '2018/19'), ('2017', '2017/18'), ('2016', '2016/17'), ('2015', '2015/16'), ('2014', '2014/15'), ('2013', '2013/14')])
clubName = SelectField("Club to search", choices=[], coerce=str)
submitButton = SubmitField("Submit")
class motmForm(FlaskForm):
startDate = DateField('DatePicker', format='%d-%m-%Y')
endDate = DateField('DatePicker', format='%d-%m-%Y')
class motmAdminForm(FlaskForm):
startDate = DateField('DatePicker', format='%d-%m-%Y')
endDate = DateField('DatePicker', format='%d-%m-%Y')
class squadListForm(FlaskForm):
teamName = SelectField("HKFC team to display")
submit = SubmitField("Submit")
class adminSettingsForm(FlaskForm):
nextOppoClub = SelectField('Next Opposition Club:', choices=[], default=mySettings('club'))
nextOppoTeam = SelectField("Next Opposition Team:", choices=[])
nextMatchDate = DateField('DatePicker', format='%Y-%m-%d', default=mySettings('date'))
currMotM = SelectField('Current Man of the Match:', choices=[], default=mySettings('motm'))
currDotD = SelectField('Current Dick of the Day:', choices=[], default=mySettings('dotd'))
saveButton = SubmitField('Save Settings')
activateButton = SubmitField('Activate MotM Vote')
class goalsAssistsForm(FlaskForm):
fixtureNumber = TextField('Fixture Number')
match = SelectField('Fixture')
homeTeam = TextField('Home Team')
awayTeam = TextField('Away Team')
playerNumber = TextField('Player Number')
playerName = TextField('Player Name')
assists = SelectField('Assists:', choices=[(0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, '4')])
goals = SelectField('Goals:', choices=[(0, '0'), (1, '1'), (2, '2'), (3, '3'), (4, '4')])
submit = SubmitField('Submit')
# def __init__(self, *args, **kwargs):
# super(goalsAssistsForm, self).__init__(*args, **kwargs)
# read_only(self.homeTeam)
# read_only(self.awayTeam)
class adminSettingsForm2(FlaskForm):
nextMatch = SelectField('Fixture', choices=[], default=mySettings('match'))
nextOppoClub = TextField('Next Opposition Club:', default=mySettings('club'))
nextOppoTeam = TextField("Next Opposition Team:")
currMotM = SelectField('Current Man of the Match:', choices=[], default=mySettings('motm'))
currDotD = SelectField('Current Dick of the Day:', choices=[], default=mySettings('dotd'))
saveButton = SubmitField('Save Settings')
activateButton = SubmitField('Activate MotM Vote')