kopia lustrzana https://github.com/wagtail/wagtail
Add a human-readable date column type
rodzic
fb8303c048
commit
3fdc3b6f9f
|
|
@ -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>
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue