You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
3.8 KiB
Python
85 lines
3.8 KiB
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, FileField, validators
|
|
from wtforms.validators import InputRequired, DataRequired, NumberRange
|
|
from wtforms import FieldList
|
|
from wtforms import Form as NoCsrfForm
|
|
from wtforms.fields import StringField, FormField, SubmitField, SelectField, RadioField
|
|
from app.models import Location, LocationSchema
|
|
from wtforms.fields import DecimalRangeField
|
|
from wtforms.widgets import TextArea
|
|
|
|
|
|
# - - - Forms - - -
|
|
# class AuthorForm(NoCsrfForm):
|
|
# # this forms is never exposed so we can use the non CSRF version
|
|
# author_name = StringField('Author Name', validators=[DataRequired()])
|
|
|
|
class UploadLocation(FlaskForm):
|
|
longitude = DecimalRangeField( 'longitude', [InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
latitude = DecimalRangeField('latitude',[InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
|
|
|
|
|
|
class UploadText(FlaskForm):
|
|
message = StringField('message', [InputRequired()], widget=TextArea(), default=None)
|
|
longitude = DecimalRangeField( 'longitude', [InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
latitude = DecimalRangeField('latitude',[InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
|
|
|
|
class UploadAudio(FlaskForm):
|
|
message = StringField('message', widget=TextArea(), default=None)
|
|
audio = FileField()
|
|
longitude = DecimalRangeField( 'longitude', [InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
latitude = DecimalRangeField('latitude',[InputRequired(),NumberRange(min=1, message="Not valid coordinates")])
|
|
|
|
|
|
|
|
# class EditForm(FlaskForm):
|
|
# title = StringField('title', validators=[InputRequired()])
|
|
# author = FieldList(FormField(AuthorForm, default=lambda: Author()), min_entries=1)
|
|
# category = StringField('category', validators=[InputRequired()])
|
|
# year_published = StringField('year published', [validators.Length(max=4)],default=None)
|
|
# file = FileField()
|
|
# message = StringField('message')
|
|
# sameness = DecimalRangeField('sameness', default=0)
|
|
# diversity = DecimalRangeField('diversity', default=0)
|
|
# gender = DecimalRangeField('gender', default=50)
|
|
# choices = [('Student', 'Student'),
|
|
# ('Librarian', 'Librarian'),
|
|
# ('Pirate', 'Pirate'),
|
|
# ('Teacher', 'Teacher'),
|
|
# ('Institution', 'Institution'),
|
|
# ('All of the above', 'All of the above'),
|
|
# ('None of the above', 'None of the above')]
|
|
# who = SelectField('', choices=choices, default='Student')
|
|
|
|
# class ChatForm(FlaskForm):
|
|
# message = StringField('message', validators=[InputRequired()])
|
|
# send = SubmitField(label='Send')
|
|
|
|
# class StackForm(FlaskForm):
|
|
# stack_name = StringField('Stack', validators=[InputRequired()])
|
|
# stack_description = StringField('Description', validators=[InputRequired()])
|
|
# stack_author = StringField('Who made this', validators=[InputRequired()])
|
|
# create = SubmitField(label='Create')
|
|
|
|
# class AddtoStackForm(FlaskForm):
|
|
# select_stack = SelectField('Stacks', validators=[InputRequired()])
|
|
|
|
# class EditStackForm(FlaskForm):
|
|
# edit_stack_name = StringField('Stack', validators=[InputRequired()])
|
|
# edit_stack_description = StringField('Description', validators=[InputRequired()])
|
|
|
|
# class SearchForm(FlaskForm):
|
|
# choices = [('All', 'All'),
|
|
# ('Title', 'Title'),
|
|
# ('Author', 'Author'),
|
|
# ('Category', 'Category'),
|
|
# ('Stack', 'Stack'),
|
|
# ('Outliers', 'Outliers')]
|
|
# select = SelectField('', choices=choices, default='All')
|
|
# search = StringField('', validators=[InputRequired()])
|
|
# # grid = SubmitField('Grid')
|
|
# # listview = SubmitField('List')
|
|
# randomize = SubmitField('Order differently')
|