From bd55cc0e3369d8f76e23bed1cc64c7be87716e8a Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 16 Aug 2020 18:40:14 +0200 Subject: [PATCH] Update shown date --- articles/templates/articles/article_detail.html | 7 ++----- articles/templates/articles/article_list.html | 7 ++++--- articles/templates/articles/date_snippet.html | 7 +++++++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 articles/templates/articles/date_snippet.html diff --git a/articles/templates/articles/article_detail.html b/articles/templates/articles/article_detail.html index fd4d307..a6f3ad7 100644 --- a/articles/templates/articles/article_detail.html +++ b/articles/templates/articles/article_detail.html @@ -2,11 +2,8 @@ {% block content %}
-

{{ article.title }}

-

By: {{ article.author }}

-

Published at: {{ article.published_at }}

-

Updated at: {{ article.updated_at }}

- +

{{ article.title }}{% if article.status != article.PUBLISHED %} ({{ article.status }}){% endif %}

+ {% include "articles/date_snippet.html" %}
{{ article.get_formatted_content|safe }}
diff --git a/articles/templates/articles/article_list.html b/articles/templates/articles/article_list.html index 6e4b75b..2468802 100644 --- a/articles/templates/articles/article_list.html +++ b/articles/templates/articles/article_list.html @@ -4,9 +4,10 @@

{{ title }} list

{% for article in articles %} {% empty %}

No article here. Come back later 🙂

diff --git a/articles/templates/articles/date_snippet.html b/articles/templates/articles/date_snippet.html new file mode 100644 index 0000000..75d2c5c --- /dev/null +++ b/articles/templates/articles/date_snippet.html @@ -0,0 +1,7 @@ +

+ {% if article.published_at %} + {{ article.published_at|date }} + {% else %} + {{ article.updated_at|date }} + {% endif %} +