From c7e56ab0380a58fd98d9fd00b0b41a67811243e6 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 6 Sep 2022 09:17:42 +0100 Subject: [PATCH] Don't show word count if there isn't one This mostly covers spotify pages, which use a custom reading time but don't have words. --- website/common/templates/common/content-details.html | 4 +++- website/spotify/models.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/website/common/templates/common/content-details.html b/website/common/templates/common/content-details.html index 1566a6b..40637cd 100644 --- a/website/common/templates/common/content-details.html +++ b/website/common/templates/common/content-details.html @@ -15,7 +15,9 @@
- {{ page.reading_time|naturaldelta }} + + {{ page.reading_time|naturaldelta }} +
{% endif %} diff --git a/website/spotify/models.py b/website/spotify/models.py index c7de89a..2efe778 100644 --- a/website/spotify/models.py +++ b/website/spotify/models.py @@ -48,6 +48,10 @@ class SpotifyPlaylistPage(BaseContentPage): ) ) + @cached_property + def word_count(self) -> int: + return 0 + @cached_property def subtitle(self) -> str: return self.playlist_data["description"]