Use a custom ISO date format to please HTML <time>
This commit is contained in:
parent
67105db5a9
commit
cfc427b603
4 changed files with 8 additions and 3 deletions
|
@ -7,3 +7,7 @@ def pages(request):
|
|||
|
||||
def drafts_count(request):
|
||||
return {"drafts_count": Article.with_pages.filter(status=Article.DRAFT).count()}
|
||||
|
||||
|
||||
def date_format(request):
|
||||
return {"CUSTOM_ISO": "Y-m-d\TH:i:sO"}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<p class="metadata">
|
||||
<a class="permalink" title="Permalink" href="#{{ comment.id }}">🔗</a>
|
||||
<span class="username">{{ comment.username }}</span> |
|
||||
<time datetime="{{ comment.created_at|date:'c' }}">
|
||||
<time datetime="{{ comment.created_at|date:CUSTOM_ISO }}">
|
||||
{{ comment.created_at|date:"DATETIME_FORMAT" }}
|
||||
</time>
|
||||
{% include "articles/admin_link_snippet.html" with article=comment %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% load i18n %}
|
||||
<p class="date">
|
||||
{% if article.published_at %}
|
||||
<time datetime="{{ article.published_at|date:'c' }}">{{ article.published_at|date }}</time>
|
||||
<time datetime="{{ article.published_at|date:CUSTOM_ISO }}">{{ article.published_at|date }}</time>
|
||||
{% else %}
|
||||
<time datetime="{{ article.updated_at|date:'c' }}">{{ article.updated_at|date }}</time>
|
||||
<time datetime="{{ article.updated_at|date:CUSTOM_ISO }}">{{ article.updated_at|date }}</time>
|
||||
{% endif %}
|
||||
{% include "articles/admin_link_snippet.html" %}
|
||||
</p>
|
||||
|
|
|
@ -96,6 +96,7 @@ TEMPLATES = [
|
|||
"django.contrib.messages.context_processors.messages",
|
||||
"articles.context_processors.pages",
|
||||
"articles.context_processors.drafts_count",
|
||||
"articles.context_processors.date_format",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
|
Reference in a new issue