diff --git a/chrono/agendas/models.py b/chrono/agendas/models.py index fc25cfa9..732754e6 100644 --- a/chrono/agendas/models.py +++ b/chrono/agendas/models.py @@ -349,7 +349,7 @@ class Event(models.Model): def export_json(self): return { - 'start_datetime': self.start_datetime.strftime('%Y-%m-%d %H:%M:%S'), + 'start_datetime': make_naive(self.start_datetime).strftime('%Y-%m-%d %H:%M:%S'), 'places': self.places, 'waiting_list_places': self.waiting_list_places, 'label': self.label diff --git a/tests/test_import_export.py b/tests/test_import_export.py index cd6a71eb..e0e01311 100644 --- a/tests/test_import_export.py +++ b/tests/test_import_export.py @@ -34,6 +34,8 @@ def get_output_of_command(command, *args, **kwargs): def test_import_export(app, some_data, meetings_agenda): + first_event = Agenda.objects.get(label='Foo bar').event_set.first() + # add exception to meeting agenda desk = meetings_agenda.desk_set.first() tpx_start = make_aware(datetime.datetime(2017, 5, 22, 8, 0)) @@ -64,6 +66,8 @@ def test_import_export(app, some_data, meetings_agenda): call_command('import_site', f.name) assert Agenda.objects.count() == 3 + first_imported_event = Agenda.objects.get(label='Foo bar').event_set.first() + assert first_imported_event.start_datetime == first_event.start_datetime assert TimePeriodException.objects.get().start_datetime == tpx_start assert TimePeriodException.objects.get().end_datetime == tpx_end