Update shown date
This commit is contained in:
parent
cbdf506227
commit
bd55cc0e33
3 changed files with 13 additions and 8 deletions
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
7
articles/templates/articles/date_snippet.html
Normal file
7
articles/templates/articles/date_snippet.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<p class="date">
|
||||
{% if article.published_at %}
|
||||
{{ article.published_at|date }}
|
||||
{% else %}
|
||||
{{ article.updated_at|date }}
|
||||
{% endif %}
|
||||
</p>
|
Reference in a new issue