mirror of https://github.com/logos-co/open-law.git
fix route on book stat
This commit is contained in:
parent
6e11307c2e
commit
9da0eea31a
|
@ -1,9 +1,4 @@
|
||||||
from flask import (
|
from flask import render_template, flash, redirect, url_for, request
|
||||||
render_template,
|
|
||||||
flash,
|
|
||||||
redirect,
|
|
||||||
url_for,
|
|
||||||
)
|
|
||||||
from flask_login import login_required, current_user
|
from flask_login import login_required, current_user
|
||||||
from sqlalchemy import and_, or_
|
from sqlalchemy import and_, or_
|
||||||
|
|
||||||
|
@ -180,11 +175,12 @@ def delete(book_id: int):
|
||||||
@bp.route("/<int:book_id>/statistics", methods=["GET"])
|
@bp.route("/<int:book_id>/statistics", methods=["GET"])
|
||||||
def statistic_view(book_id: int):
|
def statistic_view(book_id: int):
|
||||||
book = db.session.get(m.Book, book_id)
|
book = db.session.get(m.Book, book_id)
|
||||||
|
active_tab = request.args.get("active_tab")
|
||||||
if not book or book.is_deleted:
|
if not book or book.is_deleted:
|
||||||
log(log.WARNING, "Book with id [%s] not found", book_id)
|
log(log.WARNING, "Book with id [%s] not found", book_id)
|
||||||
flash("Book not found", "danger")
|
flash("Book not found", "danger")
|
||||||
return redirect(url_for("book.my_library"))
|
return redirect(url_for("book.my_library"))
|
||||||
return render_template("book/stat.html", book=book)
|
return render_template("book/stat.html", book=book, active_tab=active_tab)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/favorite_books", methods=["GET"])
|
@bp.route("/favorite_books", methods=["GET"])
|
||||||
|
|
Loading…
Reference in New Issue