File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -25,12 +25,16 @@ class ReportForm(BootstrapMixin, forms.Form):
2525 help_text = _ ("Interval at which this report is re-run (in minutes)" )
2626 )
2727
28- def clean_schedule_at (self ):
28+ def clean (self ):
2929 scheduled_time = self .cleaned_data ['schedule_at' ]
30- if scheduled_time and scheduled_time < timezone . now ():
30+ if scheduled_time and scheduled_time < local_now ():
3131 raise forms .ValidationError (_ ('Scheduled time must be in the future.' ))
3232
33- return scheduled_time
33+ # When interval is used without schedule at, raise an exception
34+ if self .cleaned_data ['interval' ] and not scheduled_time :
35+ self .cleaned_data ['schedule_at' ] = local_now ()
36+
37+ return self .cleaned_data
3438
3539 def __init__ (self , * args , ** kwargs ):
3640 super ().__init__ (* args , ** kwargs )
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ def clean(self):
5252
5353 # When interval is used without schedule at, raise an exception
5454 if self .cleaned_data ['_interval' ] and not scheduled_time :
55- raise forms . ValidationError ( _ ( 'Scheduled time must be set when recurs is used.' ) )
55+ self . cleaned_data [ '_schedule_at' ] = local_now ( )
5656
5757 return self .cleaned_data
5858
You can’t perform that action at this time.
0 commit comments