Why does django not use my SHORT_DATE_FORMAT with date template tag?

安稳与你 提交于 2019-12-06 13:50:56
djangonaut

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

Nick Sanders

The easiest way to fix this for 1.6 is create a locale folder in your app folder and to set

FORMAT_MODULE_PATH = 'myapp.locale'

then copy the en_AU folder from

https://github.com/django/django/tree/master/django/conf/locale

and then add a init.py file to the locale folder with

LANG_INFO = {
    'en-au': {
        'bidi': False,
        'code': 'en-au',
        'name': 'Australian English',
        'name_local': 'Australian English',
    },
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!