I’m serving a Python app through Django. Within the app I’m storing the classic “created” field within a few tables.
This is how the field looks like within the Django form:
created = models.DateTimeField(blank=True, default=datetime.now())
Unfortunately, datetime.now() is not accurate. In fact in the database I have sets of rows with the exact same timestamp.
The datetime.now() value seems to change every 30-45 minutes.
My Django app is served on Windows Server 2005 behind IIS6.
Help would be amazing!
because datetime.now() is being called when your module is initialised and that value is being used for the default.
You want to use the auto_now_add=True parameter
edit: no need for ‘blank’ if you’re setting the auto option.