Update shown date

This commit is contained in:
Gabriel Augendre 2020-08-16 18:40:14 +02:00
parent cbdf506227
commit bd55cc0e33
3 changed files with 13 additions and 8 deletions

View file

@ -2,11 +2,8 @@
{% block content %} {% block content %}
<article> <article>
<h1>{{ article.title }}</h1> <h1>{{ article.title }}{% if article.status != article.PUBLISHED %} ({{ article.status }}){% endif %}</h1>
<p>By: {{ article.author }}</p> {% include "articles/date_snippet.html" %}
<p>Published at: {{ article.published_at }}</p>
<p>Updated at: {{ article.updated_at }}</p>
<div> <div>
{{ article.get_formatted_content|safe }} {{ article.get_formatted_content|safe }}
</div> </div>

View file

@ -5,6 +5,7 @@
{% for article in articles %} {% for article in articles %}
<article> <article>
<h2><a href="{% url 'article-detail' pk=article.pk %}">{{ article.title }}</a></h2> <h2><a href="{% url 'article-detail' pk=article.pk %}">{{ article.title }}</a></h2>
{% include "articles/date_snippet.html" %}
<p>{{ article.get_abstract|safe }}</p> <p>{{ article.get_abstract|safe }}</p>
<p><a href="{% url 'article-detail' pk=article.pk %}">Read more</a></p> <p><a href="{% url 'article-detail' pk=article.pk %}">Read more</a></p>
</article> </article>

View file

@ -0,0 +1,7 @@
<p class="date">
{% if article.published_at %}
{{ article.published_at|date }}
{% else %}
{{ article.updated_at|date }}
{% endif %}
</p>