15 lines
578 B
Python
15 lines
578 B
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, SelectMultipleField, SubmitField
|
|
from wtforms.validators import Optional, Length, Regexp
|
|
|
|
class SearchForm(FlaskForm):
|
|
query = StringField(
|
|
'Search',
|
|
validators=[
|
|
Optional(),
|
|
Length(min=2, max=100, message="Search term must be between 2 and 100 characters."),
|
|
Regexp(r'^[\w\s\-]+$', message="Search can only include letters, numbers, spaces, and dashes.")
|
|
]
|
|
)
|
|
tags = SelectMultipleField('Tags', coerce=int)
|
|
submit = SubmitField('Search') |