Django-扩展日期模板过滤器 [英] Django - extend date template filter
本文介绍了Django-扩展日期模板过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否可以在我的设置中定义一个像 LONG_DATETIME_FORMAT ='D d F Y H:i'
这样的变量,并在如下模板中使用它: {{my_date | date:"LONG_DATETIME_FORMAT"}}
?可以在不覆盖默认 date
过滤器的情况下完成此操作吗?还是应该编写自定义过滤器?
I am wondering if I can just define a variable like LONG_DATETIME_FORMAT = 'D d F Y H:i'
in my settings and use it in template like:
{{ my_date|date:"LONG_DATETIME_FORMAT" }}
? Can this be done without overwritting default date
filter? Or should I write custom filter?
推荐答案
查看全文