본문 바로가기

Python/Django

[Django DateTimeField] auto_now와 auto_now_add

출처

https://www.geeksforgeeks.org/datetimefield-django-models/

auto_now

  • 갱신될 때마다 시간이 변함
  • Automatically set the field to now every time the object is saved.
  • Useful for “last-modified” timestamps

auto_now_add

  • 처음 만들었을 때 시간으로 고정
  • Automatically set the field to now when the object is first created.
  • Useful for creation of timestamps.