From 7e9e6f1262f76e1614e390bd4b6d5bc38346a69c Mon Sep 17 00:00:00 2001 From: tcely Date: Mon, 26 May 2025 09:03:10 -0400 Subject: [PATCH] Do not format the `datetime` --- tubesync/sync/views.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 87fb6bc6..5f13877f 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -351,7 +351,7 @@ class AddSourceView(EditSourceMixin, CreateView): initial = super().get_initial() initial['target_schedule'] = timezone.now().replace( second=0, microsecond=0, - ).isoformat(timespec='minutes') + ) for k, v in self.prepopulated_data.items(): initial[k] = v return initial @@ -398,6 +398,12 @@ class UpdateSourceView(EditSourceMixin, UpdateView): template_name = 'sync/source-update.html' + def get_initial(self): + initial = super().get_initial() + when = getattr(self.object, 'target_schedule') or timezone.now() + initial['target_schedule'] = when.replace(second=0, microsecond=0) + return initial + def get_success_url(self): url = reverse_lazy('sync:source', kwargs={'pk': self.object.pk}) return append_uri_params(url, {'message': 'source-updated'})