Show List with no file formats available

Bugfix save order of format list view
This commit is contained in:
Ozzie Isaacs 2024-02-17 11:13:49 +01:00
parent 0180b4b6b5
commit 2bea4dbd06

View File

@ -634,20 +634,33 @@ def render_ratings_books(page, book_id, order):
def render_formats_books(page, book_id, order): def render_formats_books(page, book_id, order):
name = calibre_db.session.query(db.Data).filter(db.Data.format == book_id.upper()).first() if book_id == '-1':
if name: name = _("None")
entries, random, pagination = calibre_db.fill_indexpage(page, 0, entries, random, pagination = calibre_db.fill_indexpage(page, 0,
db.Books, db.Books,
db.Books.data.any(db.Data.format == book_id.upper()), db.Data.format == None,
[order[0][0]],
True, config.config_read_column,
db.Data)
else:
name = calibre_db.session.query(db.Data).filter(db.Data.format == book_id.upper()).first()
if name:
name = name.format
entries, random, pagination = calibre_db.fill_indexpage(page, 0,
db.Books,
db.Books.data.any(
db.Data.format == book_id.upper()),
[order[0][0]], [order[0][0]],
True, config.config_read_column) True, config.config_read_column)
return render_title_template('index.html', random=random, pagination=pagination, entries=entries, id=book_id,
title=_("File format: %(format)s", format=name.format),
page="formats",
order=order[1])
else: else:
abort(404) abort(404)
return render_title_template('index.html', random=random, pagination=pagination, entries=entries, id=book_id,
title=_("File format: %(format)s", format=name),
page="formats",
order=order[1])
def render_category_books(page, book_id, order): def render_category_books(page, book_id, order):
if book_id == '-1': if book_id == '-1':
@ -1057,7 +1070,7 @@ def ratings_list():
@login_required_if_no_ano @login_required_if_no_ano
def formats_list(): def formats_list():
if current_user.check_visibility(constants.SIDEBAR_FORMAT): if current_user.check_visibility(constants.SIDEBAR_FORMAT):
if current_user.get_view_property('ratings', 'dir') == 'desc': if current_user.get_view_property('formats', 'dir') == 'desc':
order = db.Data.format.desc() order = db.Data.format.desc()
order_no = 0 order_no = 0
else: else: