can't compare datetime.datetime to datetime.date

前端 未结 6 2030
野趣味
野趣味 2020-12-05 12:20

I have the following code and am getting the above error. Since I\'m new to python I\'m having trouble understanding the syntax here and how I can fix the error:

<         


        
6条回答
  •  北海茫月
    2020-12-05 13:00

    This problem arises when you are trying to compare a date field (DateField) and a datetime field (DateTimeField).

    The solution would be check where you defined the fields in your models and ensure that the types are uniform.

    I would suggest you replace all DateField with DateTimeField.

提交回复
热议问题