ここに参照リンク


class BaseModel(models.Model):
    # auto_now_add はインスタンスの作成(DBにINSERT)する度に更新
    created_at = models.DateTimeField('作成日時', auto_now_add=True)
# # auto_now=Trueの場合はモデルインスタンスを保存する度に現在の時間で更新 updated_at = models.DateTimeField('更新日時', auto_now=True)
deleted_at = models.DateTimeField('削除日時', blank=True, null=True) objects = BaseManager()
all_objects = BaseManager(alive_only=False)

上記のコードのようにDateTimeFieldの引数であるauto_now_addをTrueとすることで
作成した日時を登録し、auto_nowをTrueとすることで更新日時を登録することができるようになった
さらにフォントアイコンでカレンダーと更新を絵文字で表している