티스토리 뷰

공부

[Django] created_at, updated_at

승가비 2020. 7. 9. 02:35
728x90
class MyModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

https://stackoverflow.com/questions/3429878/automatic-creation-date-for-django-model-form-objects

 

Automatic creation date for Django model form objects?

What's the best way to set a creation date for an object automatically, and also a field that will record when the object was last updated? models.py: created_at = models.DateTimeField(False, True,

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[Django] remove prefix app name for table  (0) 2020.07.09
[PyCharm] PYTHONPATH=  (0) 2020.07.09
[Sh] "" == true ? -> if [ -z "$VAR" ];  (0) 2020.07.09
[Jenkins] executors take up a lot of memory  (0) 2020.07.09
[Sh] if  (0) 2020.07.04
댓글