[Answer]-Django localize=True doesn't work on DateTimeField

1๐Ÿ‘

โœ…

I ran out of options but used the custom formats approach that I did before:

django FORMAT_MODULE_PATH not working

To make it work, I had to add โ€˜%d/%m/%Yโ€™ into DATETIME_INPUT_FORMATS

# -*- coding: utf-8 -*-

from __future__ import unicode_literals
from __future__ import absolute_import

DATE_FORMAT = '%d/%m/%Y'
DATE_INPUT_FORMATS = ('%d/%m/%Y', '%Y-%m-%d')
DATETIME_INPUT_FORMATS = ('%d/%m/%Y %H:%M:%S', '%Y-%m-%d %H:%M:%S', '%d/%m/%Y')
๐Ÿ‘คJames Lin

Leave a comment