我无法弄清楚这个应用程序出错的地方,试图验证日期是现在还是将来。但是我收到了有问题的错误。 这是错误:
class AppointmentManage(models.Manager):
def appointvalidate(self,postData):
errors={}
pause=datetime.datetime.strptime(time,"%Y-%m-%d %H:%M")
if len(postData['task'])<2:
errors["Task field cannot be left blank"]="task"
if len(postData['task'])<20:
errors["Task field is too long"]="task"
if len(postData['date'])<1:
errors["Date field cannot be left blank"]="date"
else:
print "this is pause "
print pause
if pause<datetime.datetime.now():
errors["Only present and future dates are permissable"]="date"
if len(postData['time'])<1:
errors["Time field cannot be left blank"]="time"
return errors