mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-08 02:09:06 -06:00
PyCharm grand repo wide reformat
This commit is contained in:
13
app/forms.py
13
app/forms.py
@@ -1,14 +1,17 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField, RadioField, FileField
|
||||
from wtforms.validators import ValidationError, DataRequired, EqualTo, Email, URL
|
||||
|
||||
from app.models import User
|
||||
|
||||
|
||||
class LoginForm(FlaskForm):
|
||||
username = StringField('Username', validators=[DataRequired()])
|
||||
password = PasswordField('Password', validators=[DataRequired()])
|
||||
remember_me = BooleanField('Remember Me')
|
||||
submit = SubmitField('Sign in')
|
||||
|
||||
|
||||
class RegistrationForm(FlaskForm):
|
||||
username = StringField('Username', validators=[DataRequired()])
|
||||
email = StringField('Email', validators=[DataRequired(), Email()])
|
||||
@@ -20,17 +23,21 @@ class RegistrationForm(FlaskForm):
|
||||
user = User.query.filter_by(username=username.data).first()
|
||||
if user is not None:
|
||||
raise ValidationError('That username is not available.')
|
||||
|
||||
|
||||
def validate_email(self, email):
|
||||
user = User.query.filter_by(email=email.data).first()
|
||||
if user is not None:
|
||||
raise ValidationError('That email address is not available.')
|
||||
|
||||
|
||||
class ProfileSettingsForm(FlaskForm):
|
||||
show_email = RadioField('Show Email', default='registered', choices=[('public', 'Public'), ('registered', 'Registered Users Only'), ('hidden', 'Hidden')])
|
||||
show_email = RadioField('Show Email', default='registered',
|
||||
choices=[('public', 'Public'), ('registered', 'Registered Users Only'),
|
||||
('hidden', 'Hidden')])
|
||||
submit = SubmitField('Save Profile Settings')
|
||||
|
||||
|
||||
class ProfilePictureForm(FlaskForm):
|
||||
profile_picture_file = FileField('Upload Profile Picture')
|
||||
profile_picture_url = StringField('Use URL for Profile Picture', validators=[URL()])
|
||||
submit = SubmitField('Submit Profile Picture')
|
||||
submit = SubmitField('Submit Profile Picture')
|
||||
|
||||
Reference in New Issue
Block a user