-
-
Save abhisuri97/e187dc7138a6131a72d3d06e218e0338 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask_wtf import Form | |
from wtforms.ext.sqlalchemy.fields import QuerySelectMultipleField | |
from wtforms.fields import StringField, SubmitField, TextAreaField, SelectField | |
from wtforms.validators import InputRequired | |
from .. import db | |
from ..models import ClubCategory | |
class NewClubForm(Form): | |
name = StringField('Please input the name of the club') | |
desc = TextAreaField('Please input the description of the club') | |
categories = QuerySelectMultipleField( | |
'Add categories for club', | |
validators=[InputRequired()], | |
get_label='category_name', | |
query_factory= | |
lambda: db.session.query(ClubCategory).order_by('category_name')) | |
submit = SubmitField('Create Club') | |
class EditClubForm(NewClubForm): | |
is_confirmed = SelectField( | |
'Please indicate whether this club entry should be shown', | |
choices=[('True', 'Yes'), ('False', 'No')]) | |
submit = SubmitField('Edit Club') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment