vvangelovski / django-audit-log

Audit log for your Django models
Other
232 stars 93 forks source link

Timezone Awareness for CreationDateTimeField #41

Open bobort opened 7 years ago

bobort commented 7 years ago

When saving a model with a CreationDateTimeField, I am getting the error that the field value is not timezone aware. (I have enabled timezone aware exceptions to happen in my Django development server.)

It is actually due to an issue in the Django code. From what I was reading, there have been debates to deprecate the auto_now and auto_now_add keyword arguments on DateTimeFields, but it hasn't happened yet and there haven't been any updates to that portion of their code base. I'm looking at it right now and wish I could just so easily change it for them.

The django-audit-log CreationDateTimeField and ModificationDateTimeField take advantage of these two keyword arguments. The general workaround seems to be to change the default value to timezone.now instead of utilizing those keyword arguments.