Refactor extant forms into form submodule
This commit is contained in:
parent
d7557784bd
commit
aa1667d795
|
@ -1,20 +1,12 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from flask import Blueprint, render_template, redirect, url_for, flash
|
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 flask_login import login_user, logout_user, login_required
|
||||||
|
|
||||||
from amanuensis.config import logger, json_rw
|
from amanuensis.config import logger, json_rw
|
||||||
|
from amanuensis.server.forms import LoginForm
|
||||||
from amanuensis.user import UserModel
|
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):
|
def get_bp(login_manager):
|
||||||
"""Create a blueprint for the auth functions"""
|
"""Create a blueprint for the auth functions"""
|
||||||
bp = Blueprint('auth', __name__, url_prefix='/auth')
|
bp = Blueprint('auth', __name__, url_prefix='/auth')
|
||||||
|
|
|
@ -3,21 +3,15 @@ import json
|
||||||
|
|
||||||
from flask import Blueprint, render_template, url_for, redirect, g, flash
|
from flask import Blueprint, render_template, url_for, redirect, g, flash
|
||||||
from flask_login import login_required, current_user
|
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 import json_ro, open_ex
|
||||||
from amanuensis.config.loader import ReadOnlyOrderedDict
|
from amanuensis.config.loader import ReadOnlyOrderedDict
|
||||||
from amanuensis.lexicon import LexiconModel
|
from amanuensis.lexicon import LexiconModel
|
||||||
|
from amanuensis.server.forms import LexiconConfigForm
|
||||||
from amanuensis.server.helpers import lexicon_param, player_required
|
from amanuensis.server.helpers import lexicon_param, player_required
|
||||||
from amanuensis.user import UserModel
|
from amanuensis.user import UserModel
|
||||||
|
|
||||||
|
|
||||||
class LexiconConfigForm(FlaskForm):
|
|
||||||
configText = TextAreaField("Config file")
|
|
||||||
submit = SubmitField("Submit")
|
|
||||||
|
|
||||||
|
|
||||||
def get_bp():
|
def get_bp():
|
||||||
"""Create a blueprint for lexicon pages"""
|
"""Create a blueprint for lexicon pages"""
|
||||||
bp = Blueprint('lexicon', __name__, url_prefix='/lexicon/<name>')
|
bp = Blueprint('lexicon', __name__, url_prefix='/lexicon/<name>')
|
||||||
|
|
Loading…
Reference in New Issue