mirror of
https://github.com/Xevion/v1.xevion.dev.git
synced 2025-12-08 02:09:06 -06:00
PyCharm grand repo wide reformat with black formatter
This commit is contained in:
53
app/forms.py
53
app/forms.py
@@ -1,43 +1,58 @@
|
||||
from flask_wtf import FlaskForm
|
||||
from wtforms import StringField, PasswordField, BooleanField, SubmitField, RadioField, FileField
|
||||
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')
|
||||
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()])
|
||||
password = PasswordField('Password', validators=[DataRequired()])
|
||||
password2 = PasswordField('Repeat Password', validators=[DataRequired(), EqualTo('password')])
|
||||
submit = SubmitField('Register')
|
||||
username = StringField("Username", validators=[DataRequired()])
|
||||
email = StringField("Email", validators=[DataRequired(), Email()])
|
||||
password = PasswordField("Password", validators=[DataRequired()])
|
||||
password2 = PasswordField(
|
||||
"Repeat Password", validators=[DataRequired(), EqualTo("password")]
|
||||
)
|
||||
submit = SubmitField("Register")
|
||||
|
||||
def validate_username(self, username):
|
||||
user = User.query.filter_by(username=username.data).first()
|
||||
if user is not None:
|
||||
raise ValidationError('That username is not available.')
|
||||
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.')
|
||||
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')])
|
||||
submit = SubmitField('Save Profile Settings')
|
||||
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')
|
||||
profile_picture_file = FileField("Upload Profile Picture")
|
||||
profile_picture_url = StringField("Use URL for Profile Picture", validators=[URL()])
|
||||
submit = SubmitField("Submit Profile Picture")
|
||||
|
||||
Reference in New Issue
Block a user