Better public create ticket form with the initialization of the datepicker for due date as a media.

Reformat code to improve readability.
Add an include to get an alert when there are errors in a form.
This commit is contained in:
bbe
2020-10-23 16:23:47 +02:00
parent ab5e07e295
commit 4ee74e6667
9 changed files with 188 additions and 164 deletions

View File

@ -173,9 +173,9 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
)
due_date = forms.DateTimeField(
widget=forms.TextInput(attrs={'class': 'form-control'}),
widget=forms.TextInput(attrs={'class': 'form-control', 'autocomplete': 'off'}),
required=False,
input_formats=['%d/%m/%Y', '%m/%d/%Y', "%d.%m.%Y", ],
input_formats=['%d/%m/%Y', '%m/%d/%Y', "%d.%m.%Y"],
label=_('Due on'),
)
@ -186,6 +186,9 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
help_text=_('You can attach a file such as a document or screenshot to this ticket.'),
)
class Media:
js = ('helpdesk/js/init_due_date.js',)
def __init__(self, kbcategory=None, *args, **kwargs):
super().__init__(*args, **kwargs)
if kbcategory: