为什么django不使用我的SHORT_DATE_FORMAT与日期模板标签? [英] Why does django not use my SHORT_DATE_FORMAT with date template tag?
问题描述
当我为日期模板标签指定时,我有理解为什么django不会在模板中使用我的SHORT_DATE_FORMAT。
我的设置是:
I have troubles understanding why django doesn't use my SHORT_DATE_FORMAT in templates when I specify it for the date template tag. My settings are:
TIME_ZONE = 'Australia/Melbourne'
SHORT_DATE_FORMAT = 'd/m/Y'
LANGUAGE_CODE = 'en-AU'
USE_I18N = True
USE_L10N = True
USE_TZ = True
在我的模板中:
{{ asset.upload_date|date:"SHORT_DATE_FORMAT" }}
我会期待'21 / 01/2014,但我得到'01 / 21 / 2014'。
I would expect '21/01/2014' but I get '01/21/2014'.
推荐答案
实际上是因为USE_L10N = True + Django仍然没有澳大利亚的区域设置/ en_AU),其指定d / m / Y。一点惊喜。但是它将在那里发布1.7
It's actually due to USE_L10N=True + Django still not having a locale conf for Australia (en-au/en_AU) which specifies d/m/Y. Bit of an surprise. But it will be there with the release of 1.7
https://code.djangoproject.com/ticket/21237
https://groups.google.com/forum/#!topic/django-users/Bgx3u1xtaMc
这篇关于为什么django不使用我的SHORT_DATE_FORMAT与日期模板标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!