Create An Automatic DateTimeField In Django
October 2024
File: SITE_NAME/APP_NAME/models.py
=
=
=
return Notes
-
auto_not_add=Truesets the datetime when the object is first created -
auto_now=Trueupdates the datetime every time the object is saved with.save() -
Note that
auto_now=Truewon't update using approaches other than.save()(e.g.QuerySet.update()won't work)
end of line
References
Note that DateTimeField is below it but it makes references to options that are in the DateField.