Django Admin 自动填写日期字段

1 from django.db import models
2 import django.utils.timezone as timezone
3 class Doc(models.Model):
4     add_date = models.DateTimeField('保存日期',default = timezone.now)
5     mod_date = models.DateTimeField('最后修改日期', auto_now = True)

参考连接:https://www.cnblogs.com/huchong/p/7895263.html

posted on 2019-01-17 11:22  TDM  阅读(804)  评论(0编辑  收藏  举报

导航