diff --git a/bookwyrm/templates/snippets/status/headers/read.html b/bookwyrm/templates/snippets/status/headers/read.html index f942c0f0a..bc6147dfe 100644 --- a/bookwyrm/templates/snippets/status/headers/read.html +++ b/bookwyrm/templates/snippets/status/headers/read.html @@ -1,7 +1,8 @@ {% spaceless %} -{% load i18n %}{% load utilities %} +{% load i18n %} +{% load utilities %} +{% load status_display %} -{% with book=status.mention_books.first %} +{% load_book status as book %} {% blocktrans with book_path=book.remote_id book=book|book_title %}finished reading {{ book }}{% endblocktrans %} -{% endwith %} {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/reading.html b/bookwyrm/templates/snippets/status/headers/reading.html index 460c4cae7..e8b51f7ba 100644 --- a/bookwyrm/templates/snippets/status/headers/reading.html +++ b/bookwyrm/templates/snippets/status/headers/reading.html @@ -1,9 +1,8 @@ {% spaceless %} {% load i18n %} {% load utilities %} +{% load status_display %} -{% with book=status.mention_books.first %} +{% load_book status as book %} {% blocktrans with book_path=book.remote_id book=book|book_title %}started reading {{ book }}{% endblocktrans %} -{% endwith %} - {% endspaceless %} diff --git a/bookwyrm/templates/snippets/status/headers/to_read.html b/bookwyrm/templates/snippets/status/headers/to_read.html index 7b89a775b..c252e71d6 100644 --- a/bookwyrm/templates/snippets/status/headers/to_read.html +++ b/bookwyrm/templates/snippets/status/headers/to_read.html @@ -1,8 +1,8 @@ {% spaceless %} {% load i18n %} {% load utilities %} +{% load status_display %} -{% with book=status.mention_books.first %} +{% load_book status as book %} {% blocktrans with book_path=book.remote_id book=book|book_title %}{{ username }} wants to read {{ book }}{% endblocktrans %} -{% endwith %} {% endspaceless %} diff --git a/bookwyrm/templatetags/status_display.py b/bookwyrm/templatetags/status_display.py index d0390e381..e43c0f944 100644 --- a/bookwyrm/templatetags/status_display.py +++ b/bookwyrm/templatetags/status_display.py @@ -70,7 +70,12 @@ def get_header_template(status): """get the path for the status template""" if isinstance(status, models.Boost): status = status.boosted_status - header_type = status.reading_status or status.status_type.lower() + try: + header_type = status.reading_status + if not header_type: + raise AttributeError() + except AttributeError: + header_type = status.status_type.lower() filename = f"snippets/status/headers/{header_type}.html" header_template = select_template([filename, "snippets/status/headers/note.html"]) return header_template.render({"status": status})