Do not format the datetime

This commit is contained in:
tcely 2025-05-26 09:03:10 -04:00 committed by GitHub
parent ec2d9d6914
commit 7e9e6f1262
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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'})