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 %}
<article>
<h1>{{ article.title }}</h1>
<p>By: {{ article.author }}</p>
<p>Published at: {{ article.published_at }}</p>
<p>Updated at: {{ article.updated_at }}</p>
<h1>{{ article.title }}{% if article.status != article.PUBLISHED %} ({{ article.status }}){% endif %}</h1>
{% include "articles/date_snippet.html" %}
<div>
{{ article.get_formatted_content|safe }}
</div>

View file

@ -4,9 +4,10 @@
<h1>{{ title }} list</h1>
{% for article in articles %}
<article>
<h2><a href="{% url 'article-detail' pk=article.pk %}">{{ article.title }}</a></h2>
<p>{{ article.get_abstract|safe }}</p>
<p><a href="{% url 'article-detail' pk=article.pk %}">Read more</a></p>
<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><a href="{% url 'article-detail' pk=article.pk %}">Read more</a></p>
</article>
{% empty %}
<p>No article here. Come back later 🙂</p>

View file

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