In django do models have a default timestamp field?

前端 未结 6 1332
误落风尘
误落风尘 2021-01-30 09:53

In django - is there a default timestamp field for all objects? That is, do I have to explicitly declare a \'timestamp\' field for \'created on\' in my Model - or is there a way

6条回答
  •  难免孤独
    2021-01-30 10:48

    If you are using django-extensions (which is a good app for adding functionality to the django-admin.py command line helper) you can get these model fields for free by inheriting from their TimeStampedModel or using their custom TimeStamp fields

提交回复
热议问题