“django.core.exceptions.ValidationError” error

后端 未结 4 1715
你的背包
你的背包 2021-01-28 23:44

I am writing a simple game in Django, all of things were right, but suddenly..., I was encountered by following error:

  • Django.v = 1.7
  • Python.v = 3.4
4条回答
  •  深忆病人
    2021-01-29 00:27

    It asked me for entering a default value for DateTimeField()

    It is doing this because you have not specified a default, and the field is not optional. Since its a destructive change, you have to provide a default value.

    You probably just hit enter and hence the exception, since a blank string is not a valid entry for DateTimeField.

    The solution is to run migrate again, and this time provide a valid date and time string; which will be used for all existing rows in your database; example of a valid format is 2015-02-12 00:00

提交回复
热议问题