Commit graph

4 commits

Author SHA1 Message Date
Kevin Alberts
6f4c6eb8a2 Make it so Django's timezone-aware DateTimeFields remain unchanged when Django resets the timezone. DateFields are not timezone-aware, so they do not need fixing.
Django converts the timezone of DateTimeFields to UTC when the field gets saved. This makes it so when you update a model which includes a DateTimeField, and your server is running in another timezone, the AuditLog will think you changed the timestamp, while it actually is the same time, but in another timezone. This commit adds a specific check in the model_instance_diff function for DateTimeField models (and any subclasses of it), which converts the old and new values to UTC before comparing them to see if they've actually changed. It also adds tests to see if the code works properly.

The extra test_setting (USE_TZ) is added because timezone support is disabled if it is not specified, this setting enables it.
2017-01-11 20:07:10 +01:00
Jan-Jelle Kester
952536f255 Additional field for metadata 2015-07-21 23:46:31 +02:00
Jan-Jelle Kester
3623812ab4 Some work on m2m relationships 2015-05-15 15:14:57 +02:00
Jan-Jelle Kester
1d5118460f Refactor tests to not use a Django project 2015-05-15 11:41:15 +02:00
Renamed from src/testapp/models.py (Browse further)