0
在我的models.py我有一個GTTime模型:如何將時間傳遞給DateTimeField?
class GTTime(models.Model):
gt_time = models.DateTimeField(null=True)
ctime = models.DateTimeField(auto_now_add=True)
uptime = models.DateTimeField(auto_now=True)
而在我的views.py,如何將時間添加到在gt_time?
我試圖用time.time()
打發時間戳記,但會報告錯誤:
gt = models.GTTime(gt_time=time.time())
gt.save()
錯誤:TypeError: expected string or buffer