From aa1667d79586500b7edcc756db13a2b5a46a0e8a Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 26 Jan 2020 23:27:47 -0800 Subject: [PATCH] Refactor extant forms into form submodule --- amanuensis/server/auth.py | 10 +--------- amanuensis/server/lexicon.py | 8 +------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/amanuensis/server/auth.py b/amanuensis/server/auth.py index 9ab642e..3d378f2 100644 --- a/amanuensis/server/auth.py +++ b/amanuensis/server/auth.py @@ -1,20 +1,12 @@ import time from flask import Blueprint, render_template, redirect, url_for, flash -from flask_wtf import FlaskForm -from wtforms import StringField, PasswordField, BooleanField, SubmitField -from wtforms.validators import DataRequired from flask_login import login_user, logout_user, login_required from amanuensis.config import logger, json_rw +from amanuensis.server.forms import LoginForm from amanuensis.user import UserModel -class LoginForm(FlaskForm): - username = StringField('Username', validators=[DataRequired()]) - password = PasswordField('Password', validators=[DataRequired()]) - remember = BooleanField('Stay logged in') - submit = SubmitField('Log in') - def get_bp(login_manager): """Create a blueprint for the auth functions""" bp = Blueprint('auth', __name__, url_prefix='/auth') diff --git a/amanuensis/server/lexicon.py b/amanuensis/server/lexicon.py index 79ef1cb..d992e6b 100644 --- a/amanuensis/server/lexicon.py +++ b/amanuensis/server/lexicon.py @@ -3,21 +3,15 @@ import json from flask import Blueprint, render_template, url_for, redirect, g, flash from flask_login import login_required, current_user -from flask_wtf import FlaskForm -from wtforms import TextAreaField, SubmitField from amanuensis.config import json_ro, open_ex from amanuensis.config.loader import ReadOnlyOrderedDict from amanuensis.lexicon import LexiconModel +from amanuensis.server.forms import LexiconConfigForm from amanuensis.server.helpers import lexicon_param, player_required from amanuensis.user import UserModel -class LexiconConfigForm(FlaskForm): - configText = TextAreaField("Config file") - submit = SubmitField("Submit") - - def get_bp(): """Create a blueprint for lexicon pages""" bp = Blueprint('lexicon', __name__, url_prefix='/lexicon/')