Enable scheduling_enabled parameter for reports

This commit is contained in:
jeremystretch
2023-04-17 13:12:14 -04:00
committed by Jeremy Stretch
parent 197c6a1cbf
commit b167153186
8 changed files with 43 additions and 18 deletions

View File

@@ -44,12 +44,12 @@ class ScriptForm(BootstrapMixin, forms.Form):
self.fields.pop('_interval')
def clean(self):
scheduled_time = self.cleaned_data['_schedule_at']
scheduled_time = self.cleaned_data.get('_schedule_at')
if scheduled_time and scheduled_time < local_now():
raise forms.ValidationError(_('Scheduled time must be in the future.'))
# When interval is used without schedule at, schedule for the current time
if self.cleaned_data['_interval'] and not scheduled_time:
if self.cleaned_data.get('_interval') and not scheduled_time:
self.cleaned_data['_schedule_at'] = local_now()
return self.cleaned_data