79 lines
2 KiB
Python
79 lines
2 KiB
Python
"""
|
|
WTForms for email generation
|
|
"""
|
|
|
|
from flask_wtf import FlaskForm
|
|
from wtforms import (
|
|
StringField,
|
|
TextAreaField,
|
|
DateTimeField,
|
|
SubmitField,
|
|
URLField
|
|
)
|
|
from wtforms.validators import (
|
|
DataRequired,
|
|
Length,
|
|
Optional,
|
|
URL as url_validators
|
|
)
|
|
|
|
|
|
class EmailGeneratorForm(FlaskForm):
|
|
"""Form for generating email invitations"""
|
|
|
|
title = StringField(
|
|
'Event Title',
|
|
validators=[
|
|
DataRequired(message='Event title is required'),
|
|
Length(max=100, message='Title must be less than 100 characters')
|
|
]
|
|
)
|
|
date_time = DateTimeField(
|
|
'Date & Time',
|
|
validators=[DataRequired(message='Date and time is required')]
|
|
)
|
|
location = StringField(
|
|
'Location',
|
|
validators=[
|
|
DataRequired(message='Location is required'),
|
|
Length(max=200, message='Location must be less than 200 characters')
|
|
]
|
|
)
|
|
description = TextAreaField(
|
|
'Description',
|
|
validators=[
|
|
DataRequired(message='Description is required'),
|
|
Length(max=2000, message='Description must be less than 2000 characters')
|
|
]
|
|
)
|
|
image_url = URLField(
|
|
'Image URL (Optional)',
|
|
validators=[Optional()]
|
|
)
|
|
button_text = StringField(
|
|
'Button Text',
|
|
validators=[
|
|
DataRequired(message='Button text is required'),
|
|
Length(max=50, message='Button text must be less than 50 characters')
|
|
]
|
|
)
|
|
button_url = URLField(
|
|
'Button URL',
|
|
validators=[DataRequired(message='Button URL is required')]
|
|
)
|
|
next_event_text = StringField(
|
|
'Next Event Text',
|
|
validators=[
|
|
Length(max=100, message='Next event text must be less than 100 characters')
|
|
]
|
|
)
|
|
next_event_url = URLField(
|
|
'Next Event URL',
|
|
validators=[Optional()]
|
|
)
|
|
submit = SubmitField('Generate Email')
|
|
|
|
|
|
class PreviewForm(FlaskForm):
|
|
"""Form for previewing email"""
|
|
preview = SubmitField('Preview Email')
|