更新时间:2023-02-26 14:23:07
问题是我需要 settings.py
文件中的 ISO 和 UK 日期格式,如下所示:
The problem turned out to be that I needed both the ISO and UK date formats in the settings.py
file like so:
DATE_INPUT_FORMATS = ('%d-%m-%Y','%Y-%m-%d')
然后将 forms.py 调整为以下内容:
and then the forms.py adjusted to the following:
class ClientDetailsForm(ModelForm):
date_of_birth = DateField(input_formats=settings.DATE_INPUT_FORMATS)
class Meta:
model = ClientDetails
为什么 USE_L10N = True
不能这样做,我不知道!
Why USE_L10N = True
can't just do this I don't know!
[感谢这个和