2020-09-23 17:00:51 -04:00
|
|
|
import re
|
|
|
|
|
2020-09-22 16:22:15 -04:00
|
|
|
from flask_table import Table, Col, LinkCol, BoolCol, DatetimeCol, NestedTableCol
|
|
|
|
from flask_wtf import FlaskForm
|
2020-09-23 17:00:51 -04:00
|
|
|
from wtforms import SelectMultipleField, StringField, BooleanField, SelectField, validators, HiddenField, TextAreaField, \
|
2020-12-14 04:49:02 -05:00
|
|
|
ValidationError
|
|
|
|
|
|
|
|
from wtforms.fields.html5 import DateField
|
2020-09-22 16:22:15 -04:00
|
|
|
from wtforms.widgets import TextArea
|
|
|
|
|
|
|
|
|
|
|
|
class InvitationForm(FlaskForm):
|
|
|
|
location = StringField('Location (ex. Newcomb Hall, South Meeting Room)', [validators.DataRequired()])
|
|
|
|
date = StringField('Date (ex. Monday, September 23 from 10:00 am-5:00 pm ', [validators.DataRequired()])
|
2020-09-23 17:00:51 -04:00
|
|
|
emails = TextAreaField('Emails (newline delimited)', render_kw={'rows': 10, 'cols': 50})
|
|
|
|
|
|
|
|
def validate_emails(form, field):
|
|
|
|
all_emails = field.data.splitlines()
|
|
|
|
EMAIL_REGEX = re.compile('^[a-z0-9]+[._a-z0-9]+[@]\w+[.]\w{2,3}$')
|
|
|
|
for email in all_emails:
|
|
|
|
if not re.search(EMAIL_REGEX, email):
|
|
|
|
raise ValidationError(f'Invalid email \'{email}\', Emails must each be on a seperate line.')
|
2020-11-03 16:01:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
class SearchForm(FlaskForm):
|
2020-12-30 09:06:46 -05:00
|
|
|
dateRange = TextAreaField('Search Range', id="dateRange")
|
2020-11-03 16:01:50 -05:00
|
|
|
studentId = TextAreaField('Student Id')
|
|
|
|
location = TextAreaField('Location')
|
2020-12-28 09:15:42 -05:00
|
|
|
compute_id = TextAreaField('Compute ID')
|
2020-12-28 09:17:56 -05:00
|
|
|
currently_showing = HiddenField(id="currently_showing")
|