瀏覽代碼

Add docs and release notes for datetime_filters tag library.

master
Samir Shah 7 年之前
父節點
當前提交
802415d366
共有 2 個文件被更改,包括 23 次插入0 次删除
  1. 20
    0
      docs/source/ref/templatetags.rst
  2. 3
    0
      docs/source/releases/v2.0.rst

+ 20
- 0
docs/source/ref/templatetags.rst 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存