zlorf / django-synchro

Django app for database data synchronization.
MIT License
66 stars 22 forks source link

Wrong date for last_check in SynchroSettings #8

Open sneawo opened 9 years ago

sneawo commented 9 years ago

In changelog i have a date with millisecond: 2015-01-26 15:00:23.559368 and in dbsettings for last_check without: 2015-01-26 13:26:56. Then it makes an update for remote on every synchronization.

To solve this, i used:

SYNCHRO_DATETIME_INPUT_FORMATS = ('%Y-%m-%d %H:%M:%S.%f',)

class DateTimeMsValue(dbsettings.DateTimeValue):
    formats_source = 'SYNCHRO_DATETIME_INPUT_FORMATS'

class SynchroSettings(dbsettings.Group):
    last_check = DateTimeMsValue('Last synchronization', default=now())

Is there any better solution?