4
我在我的模型中有一个datetime对象。 我把它发送到视图,但在html中,我不知道要写什么来格式化它。如何将datetime转换为python中的字符串django
我想
{{ item.date.strftime("%Y-%m-%d")|escape }}
,但是当我只是用
{{ item.date|escape }}
它的工作,我得到
TemplateSyntaxError: Could not parse some characters: item.date.strftime|("%Y-%m-%d")||escape
,但现在我想要的格式。
有什么建议吗?
+1:引用文档。 – 2009-04-27 19:51:37