76 lines
3.2 KiB
Python
76 lines
3.2 KiB
Python
# encoding=utf-8
|
|
from flask_wtf import FlaskForm
|
|
from wtforms import BooleanField, StringField, PasswordField, IntegerField, TextAreaField, SubmitField, RadioField, SelectField, DateField
|
|
from wtforms_components import read_only
|
|
from wtforms import validators, ValidationError
|
|
from wtforms.validators import InputRequired, Email, Length
|
|
from datetime import datetime
|
|
|
|
|
|
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 adminSettingsForm2(FlaskForm):
|
|
nextMatch = SelectField('Fixture', choices=[])
|
|
nextOppoClub = StringField('Next Opposition Club:')
|
|
nextOppoTeam = StringField("Next Opposition Team:")
|
|
currMotM = SelectField('Current Man of the Match:', choices=[])
|
|
currDotD = SelectField('Current Dick of the Day:', choices=[])
|
|
saveButton = SubmitField('Save Settings')
|
|
activateButton = SubmitField('Activate MotM Vote')
|
|
|
|
|
|
class goalsAssistsForm(FlaskForm):
|
|
fixtureNumber = StringField('Fixture Number')
|
|
match = SelectField('Fixture')
|
|
homeTeam = StringField('Home Team')
|
|
awayTeam = StringField('Away Team')
|
|
playerNumber = StringField('Player Number')
|
|
playerName = StringField('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')
|
|
|
|
|
|
class DatabaseSetupForm(FlaskForm):
|
|
"""Form for database setup and configuration."""
|
|
database_type = SelectField('Database Type',
|
|
choices=[('sqlite', 'SQLite'), ('mysql', 'MySQL/MariaDB'), ('postgresql', 'PostgreSQL')],
|
|
validators=[InputRequired()])
|
|
|
|
# SQLite fields
|
|
sqlite_database_path = StringField('Database File Path',
|
|
default='hockey_results.db',
|
|
validators=[InputRequired()])
|
|
|
|
# MySQL/MariaDB fields
|
|
mysql_host = StringField('Host', default='localhost')
|
|
mysql_port = IntegerField('Port', default=3306)
|
|
mysql_database = StringField('Database Name', default='hockey_results')
|
|
mysql_username = StringField('Username', default='root')
|
|
mysql_password = PasswordField('Password')
|
|
mysql_charset = StringField('Charset', default='utf8mb4')
|
|
|
|
# PostgreSQL fields
|
|
postgres_host = StringField('Host', default='localhost')
|
|
postgres_port = IntegerField('Port', default=5432)
|
|
postgres_database = StringField('Database Name', default='hockey_results')
|
|
postgres_username = StringField('Username', default='postgres')
|
|
postgres_password = PasswordField('Password')
|
|
|
|
# Setup options
|
|
create_sample_data = BooleanField('Create Sample Data', default=True)
|
|
initialize_tables = BooleanField('Initialize Database Tables', default=True)
|
|
|
|
# Action buttons
|
|
test_connection = SubmitField('Test Connection')
|
|
save_config = SubmitField('Save Configuration')
|
|
initialize_database = SubmitField('Initialize Database')
|