型号:
{% for result in results %}
<tr>
<td><a href="/test/result/{{ result.id }}/">{{ result.title }}</a></td>
<td>{{result.date_end}}</td>
<td>{{ result.percents }}%</td>
<td><a href="/test/result/{{ result.id }}/">
<button style="width:50px; height:30px;
background-image:url({{STATIC_URL}}/css/images/eye46.png);
background-repeat:no-repeat;
border-radius: 6px;
background-position: 50% 50%;" title="Show result"></button>
</a></td>
</tr>
{% endfor %}
模板:
...
<td>{{result.date_end|date:"M d, Y"}}</td>
...
结果:
如果我使用日期格式(即&#34; M d,Y&#34;):
...
<td>{{my_value|date:"M d, Y"}}</td>
...
日期未显示:
有什么问题?
更新
如果我使用的变量不是来自&#34; for loop&#34;过滤器工作并显示日期:
SELECT (SELECT value FROM your_table WHERE year = 2014) -
(SELECT value FROM your_table WHERE year = 2013) AS Area