Add a human-readable date column type

pull/7574/head
Matt Westcott 2021-08-11 15:45:48 +01:00
rodzic fb8303c048
commit 3fdc3b6f9f
2 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,6 @@
{% load i18n wagtailadmin_tags %}
<td {% if column.classname %}class="{{ column.classname }}"{% endif %}>
{% if value %}
<div class="human-readable-date" title="{{ value|date:"DATETIME_FORMAT" }}">{% blocktrans with time_period=value|timesince %}{{ time_period }} ago{% endblocktrans %}</div>
{% endif %}
</td>

Wyświetl plik

@ -138,6 +138,11 @@ class StatusFlagColumn(Column):
self.false_label = false_label
class DateColumn(Column):
"""Outputs a date in human-readable format"""
cell_template_name = "wagtailadmin/tables/date_cell.html"
class Table(Component):
template_name = "wagtailadmin/tables/table.html"
classname = 'listing'