Django datetimefield格式

时间:2016-05-23 08:38:03

标签: python django django-models

尝试在django DateTimeField中存储日期时间时出现验证错误。

我想要保存的格式如下,以及错误。 :

Traceback (most recent call last):

  File "<ipython-input-45-8f425ac79b9d>", line 1, in <module>
    process.extractOne("cowboys", choices)

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/process.py", line 161, in extractOne
    best_list = extract(query, choices, processor, scorer, limit=1)

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/process.py", line 110, in extract
    score = scorer(query, processed)

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/fuzz.py", line 247, in WRatio
    partial = partial_ratio(p1, p2) * partial_scale

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/utils.py", line 23, in decorator
    return func(*args, **kwargs)

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/utils.py", line 32, in decorator
    return func(*args, **kwargs)

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/fuzz.py", line 69, in partial_ratio
    blocks = m.get_matching_blocks()

  File "/usr/lib/python3/dist-packages/fuzzywuzzy/StringMatcher.py", line 58, in get_matching_blocks
    self._str1, self._str2)

TypeError: inverse expected a list of edit operations

在我的django设置中,我有:

DATE_INPUT_FORMATS =(“%d%b%Y”,)

我应该在保存之前转换格式,还是可以添加到django.core.exceptions.ValidationError: ["'Mon, 23 May 2016 08:30:15 GMT' value has an invalid format. It must be in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][T