- Replace Next.js/React implementation with Python Flask - Add colorful blue-purple-teal gradient theme replacing red design - Integrate logo and Transalpina panoramic background image - Implement complete authentication system with Flask-Login - Add community features for stories and tracks sharing - Create responsive design with Tailwind CSS - Add error handling with custom 404/500 pages - Include Docker deployment configuration - Add favicon support and proper SEO structure - Update content for Pensiune BuonGusto accommodation - Remove deprecated Next.js files and dependencies Features: ✅ Landing page with hero section and featured content ✅ User registration and login system ✅ Community section for adventure sharing ✅ Admin panel for content management ✅ Responsive mobile-first design ✅ Docker containerization with PostgreSQL ✅ Email integration with Flask-Mail ✅ Form validation with WTForms ✅ SQLAlchemy database models ✅ Error pages and favicon handling
55 lines
3.1 KiB
Python
55 lines
3.1 KiB
Python
from flask_wtf import FlaskForm
|
|
from wtforms import StringField, TextAreaField, PasswordField, BooleanField, SelectField, FileField, SubmitField
|
|
from wtforms.validators import DataRequired, Email, Length, EqualTo, NumberRange
|
|
from flask_wtf.file import FileAllowed, FileRequired
|
|
|
|
class LoginForm(FlaskForm):
|
|
email = StringField('Email', validators=[DataRequired(), Email()],
|
|
render_kw={"placeholder": "Enter your email"})
|
|
password = PasswordField('Password', validators=[DataRequired()],
|
|
render_kw={"placeholder": "Enter your password"})
|
|
remember_me = BooleanField('Remember Me')
|
|
submit = SubmitField('Sign In')
|
|
|
|
class RegisterForm(FlaskForm):
|
|
nickname = StringField('Nickname', validators=[DataRequired(), Length(min=3, max=20)],
|
|
render_kw={"placeholder": "Choose a nickname"})
|
|
email = StringField('Email', validators=[DataRequired(), Email()],
|
|
render_kw={"placeholder": "Enter your email"})
|
|
password = PasswordField('Password', validators=[DataRequired(), Length(min=8)],
|
|
render_kw={"placeholder": "Create a password"})
|
|
password2 = PasswordField('Confirm Password',
|
|
validators=[DataRequired(), EqualTo('password')],
|
|
render_kw={"placeholder": "Confirm your password"})
|
|
submit = SubmitField('Register')
|
|
|
|
class ForgotPasswordForm(FlaskForm):
|
|
email = StringField('Email', validators=[DataRequired(), Email()],
|
|
render_kw={"placeholder": "Enter your email"})
|
|
submit = SubmitField('Reset Password')
|
|
|
|
class PostForm(FlaskForm):
|
|
title = StringField('Title', validators=[DataRequired(), Length(min=5, max=200)],
|
|
render_kw={"placeholder": "Give your adventure a catchy title"})
|
|
subtitle = StringField('Subtitle', validators=[Length(max=300)],
|
|
render_kw={"placeholder": "A brief description (optional)"})
|
|
content = TextAreaField('Content', validators=[DataRequired(), Length(min=50)],
|
|
render_kw={"placeholder": "Tell us about your adventure...", "rows": 10})
|
|
difficulty = SelectField('Difficulty',
|
|
choices=[('1', 'Very Easy'), ('2', 'Easy'), ('3', 'Moderate'),
|
|
('4', 'Hard'), ('5', 'Very Hard')],
|
|
validators=[DataRequired()], default='3')
|
|
images = FileField('Photos',
|
|
validators=[FileAllowed(['jpg', 'jpeg', 'png', 'gif'], 'Images only!')],
|
|
render_kw={"multiple": True, "accept": "image/*"})
|
|
gpx_file = FileField('GPX Track',
|
|
validators=[FileAllowed(['gpx'], 'GPX files only!')],
|
|
render_kw={"accept": ".gpx"})
|
|
published = BooleanField('Publish immediately', default=True)
|
|
submit = SubmitField('Create Post')
|
|
|
|
class CommentForm(FlaskForm):
|
|
content = TextAreaField('Comment', validators=[DataRequired(), Length(min=10, max=1000)],
|
|
render_kw={"placeholder": "Share your thoughts...", "rows": 3})
|
|
submit = SubmitField('Post Comment')
|