Browse Source

Add docs and release notes for datetime_filters tag library.

master
Samir Shah 7 years ago
parent
commit
802415d366
2 changed files with 23 additions and 0 deletions
  1. 20
    0
      docs/source/ref/templatetags.rst
  2. 3
    0
      docs/source/releases/v2.0.rst

+ 20
- 0
docs/source/ref/templatetags.rst View File

@@ -124,3 +124,23 @@ Argument             Description
124 124
 ``basket``           The basket instance to calculate shipping charges for
125 125
 ``name``             The variable name to assign the charge to
126 126
 ===================  =====================================================
127
+
128
+Datetime filters
129
+-------------
130
+
131
+Load these tags using ``{% load datetime_filters %}``.
132
+
133
+``timedelta``
134
+~~~~~~~~~~~~~~~~~
135
+
136
+Returns a human-readable string representation of a time delta, in the current locale:
137
+
138
+.. code-block:: html+django
139
+
140
+    Time since creation: {{ basket.time_since_creation|timedelta }}
141
+
142
+This renders something like:
143
+
144
+.. code-block:: html
145
+
146
+    Time since creation: 2 days

+ 3
- 0
docs/source/releases/v2.0.rst View File

@@ -129,6 +129,9 @@ Minor changes
129 129
   and the logic in ``ProductReviewList`` adjusted so that the form fields
130 130
   don't have to be rendered manually because of form errors.
131 131
 
132
+- Added a ``datetime_filters`` tag library that provides a ``timedelta`` template
133
+  filter for rendering time deltas in human readable format.
134
+
132 135
 Dependency changes
133 136
 ------------------
134 137
 

Loading…
Cancel
Save