mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-10 05:54:38 +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,
|
||||
redirect,
|
||||
url_for,
|
||||
request,
|
||||
)
|
||||
from flask_login import login_required, current_user
|
||||
from sqlalchemy import and_, or_
|
||||
@ -25,18 +24,15 @@ from .bp import bp
|
||||
|
||||
@bp.route("/all", methods=["GET"])
|
||||
def get_all():
|
||||
q = request.args.get("q", type=str, default=None)
|
||||
books: m.Book = m.Book.query.order_by(m.Book.id)
|
||||
if q:
|
||||
books = books.filter(m.Book.label.like(f"{q}"))
|
||||
|
||||
books: m.Book = m.Book.query.filter(m.Book.is_deleted is not False).order_by(
|
||||
m.Book.id
|
||||
)
|
||||
pagination = create_pagination(total=books.count())
|
||||
|
||||
return render_template(
|
||||
"book/all.html",
|
||||
books=books.paginate(page=pagination.page, per_page=pagination.per_page),
|
||||
page=pagination,
|
||||
search_query=q,
|
||||
all_books=True,
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user