make all this have a login page, use ldap, put a logo on, moved some upstream stuff to static/ -- need to do more here to be consistent with bootstrap 5, but for another day

This commit is contained in:
2022-06-19 22:45:54 +10:00
parent 4725f006bc
commit c29f73f8ab
14 changed files with 274 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
from wtforms import SubmitField, StringField, HiddenField, validators, Form
from flask_wtf import FlaskForm
from flask import request, render_template, redirect
from flask_login import login_required, current_user
from main import db, app, ma
from sqlalchemy import Sequence
from sqlalchemy.exc import SQLAlchemyError
@@ -41,6 +42,7 @@ class AuthorForm(FlaskForm):
# /authors -> GET only -> prints out list of all authors
################################################################################
@app.route("/authors", methods=["GET"])
@login_required
def authors():
authors = Author.query.all()
return render_template("authors.html", authors=authors, alert=st.GetAlert(), message=st.GetMessage() )
@@ -50,6 +52,7 @@ def authors():
# /author -> GET/POST -> creates a new author type and when created, takes you back to /authors
################################################################################
@app.route("/author", methods=["GET", "POST"])
@login_required
def new_author():
form = AuthorForm(request.form)
page_title='Create new Author'
@@ -71,6 +74,7 @@ def new_author():
# /author/<id> -> GET/POST(save or delete) -> shows/edits/delets a single author
################################################################################
@app.route("/author/<id>", methods=["GET", "POST"])
@login_required
def author(id):
### DDP: should this be request.form or request.values?
form = AuthorForm(request.form)