class Post(models.Model):
...
publish = models.DateTimeField(default=timezone.now)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
GPT gave me this explanation:
- default=timezone.now: Sets the field to the current time by default
but can be overridden when creating an object. - auto_now_add=True: Automatically sets the field to the current time
when the object is created and cannot be overridden.
Is that it? I feel that this explanation isn’t complete, that there’s also something else.
GPT says that timezone.now() in Django returns the current datetime in the current timezone as set in your Django project settings. Why to set datetimefield in the current timezone?
I feel that there’s some other difference besides just the ability to be overriden, or no?