Use DATETIME_FORMAT for localization in templates (#7321)

pull/6149/merge
Andrew Stone 2021-07-07 15:04:51 -07:00 zatwierdzone przez Matt Westcott
rodzic e0ac8ae73d
commit ded8bacc5d
14 zmienionych plików z 15 dodań i 13 usunięć

Wyświetl plik

@ -16,6 +16,7 @@ Changelog
* Add Google Data Studio to the list of oEmbed providers (Petr Dlouhý)
* Added instructions on copying and aliasing pages to the editor's guide in documentation (Vlad Podgurschi)
* Allow ListBlock to raise validation errors that are not attached to an individual child block (Matt Westcott)
* Use `DATETIME_FORMAT` for localization in templates (Andrew Stone)
* Fix: Invalid filter values for foreign key fields in the API now give an error instead of crashing (Tidjani Dia)
* Fix: Ordering specified in `construct_explorer_page_queryset` hook is now taken into account again by the page explorer API (Andre Fonseca)
* Fix: Deleting a page from its listing view no longer results in a 404 error (Tidjani Dia)

Wyświetl plik

@ -24,6 +24,7 @@ Other features
* Added instructions on copying and aliasing pages to the editor's guide in documentation (Vlad Podgurschi)
* Add Google Data Studio to the list of oEmbed providers (Petr Dlouhý)
* Allow ListBlock to raise validation errors that are not attached to an individual child block (Matt Westcott)
* Use ``DATETIME_FORMAT`` for localization in templates (Andrew Stone)
Bug fixes
~~~~~~~~~

Wyświetl plik

@ -43,7 +43,7 @@
</ul>
</td>
<td>{# Deliberately empty #}</td>
<td valign="top"><div class="human-readable-date" title="{{ page.locked_at|date:"d M Y H:i" }}">{% blocktrans with time_period=page.locked_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div></td>
<td valign="top"><div class="human-readable-date" title="{{ page.locked_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=page.locked_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div></td>
</tr>
{% endfor %}
</tbody>

Wyświetl plik

@ -61,7 +61,7 @@
{{ revision.page.content_type.model_class.get_verbose_name }}
</td>
<td valign="top">
<div class="human-readable-date" title="{{ revision.created_at|date:"d M Y H:i" }}">{% blocktrans with time_period=revision.created_at|timesince_simple %}{{ time_period }}{% endblocktrans %} </div>
<div class="human-readable-date" title="{{ revision.created_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=revision.created_at|timesince_simple %}{{ time_period }}{% endblocktrans %} </div>
{% if revision.user %}
by {{ revision.user|user_display_name }}
{% endif %}

Wyświetl plik

@ -41,7 +41,7 @@
<td valign="top">
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}
</td>
<td valign="top"><div class="human-readable-date" title="{{ revision.created_at|date:"d M Y H:i" }}">{% blocktrans with time_period=revision.created_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div></td>
<td valign="top"><div class="human-readable-date" title="{{ revision.created_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=revision.created_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div></td>
</tr>
{% endfor %}
</tbody>

Wyświetl plik

@ -41,7 +41,7 @@
{{ workflow_state.current_task_state.task.name }}
</td>
<td valign="top">
<div class="human-readable-date" title="{{ workflow_state.current_task_state.started_at|date:"d M Y H:i" }}">{% blocktrans with time_period=workflow_state.current_task_state.started_at|timesince_simple %}{{ time_period }}{% endblocktrans %} </div>
<div class="human-readable-date" title="{{ workflow_state.current_task_state.started_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=workflow_state.current_task_state.started_at|timesince_simple %}{{ time_period }}{% endblocktrans %} </div>
</td>
</tr>
{% endwith %}

Wyświetl plik

@ -64,7 +64,7 @@
{% endfor %}
</td>
<td valign="top">
<div class="human-readable-date" title="{{ task_state.started_at|date:"d M Y H:i" }}">{% blocktrans with time_period=task_state.started_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div>
<div class="human-readable-date" title="{{ task_state.started_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=task_state.started_at|timesince_simple %}{{ time_period }}{% endblocktrans %}</div>
</td>
</tr>
{% endwith %}

Wyświetl plik

@ -49,7 +49,7 @@
{% include "wagtailadmin/shared/user_avatar.html" with user=entry.user username=entry.user_display_name %}
</td>
<td class="updated">
<div class="human-readable-date" title="{{ entry.timestamp|date:"d M Y H:i" }}">{% blocktrans with time_period=entry.timestamp|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
<div class="human-readable-date" title="{{ entry.timestamp|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=entry.timestamp|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
</td>
</tr>
{% endfor %}

Wyświetl plik

@ -24,7 +24,7 @@
{% block parent_page_title %}
{% endblock %}
</td>
<td class="updated" valign="bottom">{% if parent_page.latest_revision_created_at %}<div class="human-readable-date" title="{{ parent_page.latest_revision_created_at|date:"d M Y H:i" }}">{% blocktrans with time_period=parent_page.latest_revision_created_at|timesince %}{{ time_period }} ago{% endblocktrans %}</div>{% endif %}</td>
<td class="updated" valign="bottom">{% if parent_page.latest_revision_created_at %}<div class="human-readable-date" title="{{ parent_page.latest_revision_created_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=parent_page.latest_revision_created_at|timesince %}{{ time_period }} ago{% endblocktrans %}</div>{% endif %}</td>
<td class="type" valign="bottom">
{% if not parent_page.is_root %}
{{ parent_page.content_type.model_class.get_verbose_name }}
@ -65,7 +65,7 @@
{% endblock %}
</td>
{% endif %}
<td class="updated" valign="top">{% if page.latest_revision_created_at %}<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"d M Y H:i" }}">{% blocktrans with time_period=page.latest_revision_created_at|timesince %}{{ time_period }} ago{% endblocktrans %}</div>{% endif %}</td>
<td class="updated" valign="top">{% if page.latest_revision_created_at %}<div class="human-readable-date" title="{{ page.latest_revision_created_at|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=page.latest_revision_created_at|timesince %}{{ time_period }} ago{% endblocktrans %}</div>{% endif %}</td>
<td class="type" valign="top">{{ page.content_type.model_class.get_verbose_name }}</td>
<td class="status" valign="top">
{% include "wagtailadmin/shared/page_status_tag.html" with page=page %}

Wyświetl plik

@ -44,7 +44,7 @@
</td>
<td>{{ workflow_state.requested_by|user_display_name }}</td>
<td>
<div class="human-readable-date" title="{{ workflow_state.created_at|date:"d M Y H:i" }}">
<div class="human-readable-date" title="{{ workflow_state.created_at|date:"DATETIME_FORMAT" }}">
{% blocktrans with time_period=workflow_state.created_at|timesince %}{{ time_period }} ago{% endblocktrans %}
</div>
</td>

Wyświetl plik

@ -14,7 +14,7 @@
{% page_permissions page as perms %}
<p>
{% if page.locked_at %}
{% with page.locked_at|date:"d M Y H:i" as locking_date %}
{% with page.locked_at|date:"DATETIME_FORMAT" as locking_date %}
{% if page.locked_by %}
{% if page.locked_by_id == request.user.pk %}
{% blocktrans %}

Wyświetl plik

@ -42,7 +42,7 @@
{% include "wagtailadmin/shared/user_avatar.html" with user=entry.user username=entry.user_display_name %}
</td>
<td class="updated">
<div class="human-readable-date" title="{{ entry.timestamp|date:"d M Y H:i" }}">{% blocktrans with time_period=entry.timestamp|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
<div class="human-readable-date" title="{{ entry.timestamp|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=entry.timestamp|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
</td>
</tr>
{% endfor %}

Wyświetl plik

@ -47,7 +47,7 @@
<td>{{ doc.collection.name }}</td>
{% endif %}
<td>
<div class="human-readable-date" title="{{ doc.created_at|date:"d M Y H:i" }}">
<div class="human-readable-date" title="{{ doc.created_at|date:"DATETIME_FORMAT" }}">
{% blocktrans with time_period=doc.created_at|timesince %}{{ time_period }} ago{% endblocktrans %}
</div>
</td>

Wyświetl plik

@ -44,7 +44,7 @@
<td class="username" valign="top">{{ user.get_username }}</td>
<td class="level" valign="top">{% if user.is_superuser %}{% trans "Admin" %}{% endif %}</td>
<td class="status" valign="top"><div class="status-tag {% if user.is_active %}primary{% endif %}">{% if user.is_active %}{% trans "Active" %}{% else %}{% trans "Inactive" %}{% endif %}</div></td>
<td {% if user.last_login %} class="human-readable-date" title="{{ user.last_login|date:"d M Y H:i" }}"{% endif %}>{% if user.last_login %}{% blocktrans with time_period=user.last_login|timesince %}{{ time_period }} ago{% endblocktrans %}{% endif %}</td>
<td {% if user.last_login %} class="human-readable-date" title="{{ user.last_login|date:"DATETIME_FORMAT" }}"{% endif %}>{% if user.last_login %}{% blocktrans with time_period=user.last_login|timesince %}{{ time_period }} ago{% endblocktrans %}{% endif %}</td>
</tr>
{% endfor %}
</tbody>