Skip to content

Instantly share code, notes, and snippets.

@abhisuri97
Created November 27, 2017 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhisuri97/e187dc7138a6131a72d3d06e218e0338 to your computer and use it in GitHub Desktop.
Save abhisuri97/e187dc7138a6131a72d3d06e218e0338 to your computer and use it in GitHub Desktop.
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