|
|
@@ -2,7 +2,7 @@ from django import forms
|
|
|
from django.utils import timezone
|
|
|
from django.utils.translation import gettext as _
|
|
|
|
|
|
-from utilities.forms import BootstrapMixin, DateTimePicker
|
|
|
+from utilities.forms import BootstrapMixin, DateTimePicker, SelectDurationWidget
|
|
|
|
|
|
__all__ = (
|
|
|
'ReportForm',
|
|
|
@@ -20,6 +20,7 @@ class ReportForm(BootstrapMixin, forms.Form):
|
|
|
required=False,
|
|
|
min_value=1,
|
|
|
label=_("Recurs every"),
|
|
|
+ widget=SelectDurationWidget(),
|
|
|
help_text=_("Interval at which this report is re-run (in minutes)")
|
|
|
)
|
|
|
|
|
|
@@ -29,3 +30,10 @@ class ReportForm(BootstrapMixin, forms.Form):
|
|
|
raise forms.ValidationError(_('Scheduled time must be in the future.'))
|
|
|
|
|
|
return scheduled_time
|
|
|
+
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
+ super().__init__(*args, **kwargs)
|
|
|
+
|
|
|
+ # Annotate the current system time for reference
|
|
|
+ now = timezone.now().strftime('%Y-%m-%d %H:%M:%S')
|
|
|
+ self.fields['schedule_at'].help_text += f' (current time: <strong>{now}</strong>)'
|