|
@@ -2,7 +2,7 @@ from django import forms
|
|
|
from django.utils import timezone
|
|
from django.utils import timezone
|
|
|
from django.utils.translation import gettext as _
|
|
from django.utils.translation import gettext as _
|
|
|
|
|
|
|
|
-from utilities.forms import BootstrapMixin, DateTimePicker
|
|
|
|
|
|
|
+from utilities.forms import BootstrapMixin, DateTimePicker, SelectDurationWidget
|
|
|
|
|
|
|
|
__all__ = (
|
|
__all__ = (
|
|
|
'ScriptForm',
|
|
'ScriptForm',
|
|
@@ -26,12 +26,17 @@ class ScriptForm(BootstrapMixin, forms.Form):
|
|
|
required=False,
|
|
required=False,
|
|
|
min_value=1,
|
|
min_value=1,
|
|
|
label=_("Recurs every"),
|
|
label=_("Recurs every"),
|
|
|
|
|
+ widget=SelectDurationWidget(),
|
|
|
help_text=_("Interval at which this script is re-run (in minutes)")
|
|
help_text=_("Interval at which this script is re-run (in minutes)")
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
def __init__(self, *args, **kwargs):
|
|
|
super().__init__(*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>)'
|
|
|
|
|
+
|
|
|
# Move _commit and _schedule_at to the end of the form
|
|
# Move _commit and _schedule_at to the end of the form
|
|
|
schedule_at = self.fields.pop('_schedule_at')
|
|
schedule_at = self.fields.pop('_schedule_at')
|
|
|
interval = self.fields.pop('_interval')
|
|
interval = self.fields.pop('_interval')
|