Varia library working group XPPL. https://gitea.xpub.nl/XPUB/XPPL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.0 KiB

7 years ago
from flask_wtf import FlaskForm
7 years ago
from wtforms import StringField, FileField, validators
from wtforms.validators import InputRequired, DataRequired
from wtforms import FieldList
from wtforms import Form as NoCsrfForm
from wtforms.fields import StringField, FormField, SubmitField, SelectField
7 years ago
from app.models import Book, BookSchema, Author, Stack, StackSchema
# - - - Forms - - -
class AuthorForm(NoCsrfForm):
# this forms is never exposed so we can user the non CSRF version
author_name = StringField('Author Name', validators=[DataRequired()])
7 years ago
7 years ago
class UploadForm(FlaskForm):
7 years ago
title = StringField('title', validators=[InputRequired()])
author = FieldList(FormField(AuthorForm, default=lambda: Author()), min_entries=1)
7 years ago
category = StringField('category', validators=[InputRequired()])
year_published = StringField('year published', [validators.Length(max=4)],default=None)
7 years ago
file = FileField()
7 years ago
upload = SubmitField(label='Upload')
wish = SubmitField(label='''I don't have the file, but wish I did.''')
7 years ago
class EditForm(FlaskForm):
title = StringField('title', validators=[InputRequired()])
author = FieldList(FormField(AuthorForm, default=lambda: Author()), min_entries=1)
7 years ago
category = StringField('category', validators=[InputRequired()])
year_published = StringField('year published', [validators.Length(max=4)],default=None)
7 years ago
class ChatForm(FlaskForm):
message = StringField('message', validators=[InputRequired()])
send = SubmitField(label='Send')
7 years ago
class StackForm(FlaskForm):
stack_name = StringField('Stack', validators=[InputRequired()])
stack_description = StringField('Description', validators=[InputRequired()])
create = SubmitField(label='Create')
7 years ago
class AddtoStackForm(FlaskForm):
7 years ago
select_stack = SelectField('Stacks', validators=[InputRequired()])
7 years ago
class SearchForm(FlaskForm):
choices = [('All', 'All'),
('Title', 'Title'),
('Category', 'Category')]
select = SelectField('', choices=choices)
7 years ago
search = StringField('', validators=[InputRequired()])