Django DateTimeField auto_now_add not working

前端 未结 4 786
花落未央
花落未央 2021-02-04 08:04

In one of the model i have set one timestamp field as follows:

created_datetime = models.DateTimeField(auto_now_add = True)

While in shell i am

4条回答
  •  被撕碎了的回忆
    2021-02-04 08:31

    The following way is in the "part1" of django documentation

    from django.utils import timezone
    p = Poll(question="What's new?", pub_date=timezone.now())
    

提交回复
热议问题