mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-13 23:36:28 +00:00
hot fix for all books page
This commit is contained in:
parent
c5d1f8a65a
commit
2a93fdcb1f
@ -3,7 +3,6 @@ from flask import (
|
|||||||
flash,
|
flash,
|
||||||
redirect,
|
redirect,
|
||||||
url_for,
|
url_for,
|
||||||
request,
|
|
||||||
)
|
)
|
||||||
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_
|
||||||
@ -25,18 +24,15 @@ from .bp import bp
|
|||||||
|
|
||||||
@bp.route("/all", methods=["GET"])
|
@bp.route("/all", methods=["GET"])
|
||||||
def get_all():
|
def get_all():
|
||||||
q = request.args.get("q", type=str, default=None)
|
books: m.Book = m.Book.query.filter(m.Book.is_deleted is not False).order_by(
|
||||||
books: m.Book = m.Book.query.order_by(m.Book.id)
|
m.Book.id
|
||||||
if q:
|
)
|
||||||
books = books.filter(m.Book.label.like(f"{q}"))
|
|
||||||
|
|
||||||
pagination = create_pagination(total=books.count())
|
pagination = create_pagination(total=books.count())
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"book/all.html",
|
"book/all.html",
|
||||||
books=books.paginate(page=pagination.page, per_page=pagination.per_page),
|
books=books.paginate(page=pagination.page, per_page=pagination.per_page),
|
||||||
page=pagination,
|
page=pagination,
|
||||||
search_query=q,
|
|
||||||
all_books=True,
|
all_books=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user