code cleanup in is_shelf_type template tag

This commit is contained in:
Hugh Rundle 2021-11-15 21:19:16 +11:00
parent 168a2488e2
commit eab2ec0ffd
No known key found for this signature in database
GPG key ID: CD23D6039184286B

View file

@ -42,12 +42,12 @@ def get_book_description(book):
@register.filter(name="is_shelf_type") @register.filter(name="is_shelf_type")
def shelf_type(current_shelf, shelf_type): def is_shelf_type(current_shelf, shelf_type):
"""is this shelf a readthrough shelf?""" """is this shelf a readthrough shelf?"""
readthrough = current_shelf in ["to-read", "reading", "read"] readthrough = current_shelf in ["to-read", "reading", "read"]
if shelf_type == "readthrough" and readthrough == True: if shelf_type == "readthrough" and bool(readthrough):
return True return True
if shelf_type == "custom" and readthrough == False: if shelf_type == "custom" and not readthrough:
return True return True
return False return False