From f8cccbcf0aea54f74fda2b0ecce59ad5c1b85db6 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Fri, 26 Jul 2024 08:46:26 +0000 Subject: [PATCH] Display custom fields in Follow-up form --- helpdesk/forms.py | 21 +++++++++++++++++++++ helpdesk/templates/helpdesk/ticket.html | 4 ++++ helpdesk/views/staff.py | 5 +++++ 3 files changed, 30 insertions(+) diff --git a/helpdesk/forms.py b/helpdesk/forms.py index 83a3de45..3b2c3c81 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -180,6 +180,27 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm): return super(EditTicketForm, self).save(*args, **kwargs) +class EditTicketCustomFieldForm(EditTicketForm): + """ + Uses the EditTicketForm logic to provide a form for Ticket custom fields. + """ + + def __init__(self, *args, **kwargs): + """ + Add any custom fields that are defined to the form + """ + super(EditTicketCustomFieldForm, self).__init__(*args, **kwargs) + + del self.fields['merged_to'] + + class Meta: + model = Ticket + exclude = ('title', 'queue', 'created', 'modified', + 'submitter_email', 'assigned_to', 'status', + 'on_hold', 'description', 'resolution', 'priority', + 'due_date', 'last_escalation', 'secret_key', 'kbitem') + + class EditFollowUpForm(forms.ModelForm): class Meta: diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html index ce7d61e4..dfa8c9ee 100644 --- a/helpdesk/templates/helpdesk/ticket.html +++ b/helpdesk/templates/helpdesk/ticket.html @@ -163,6 +163,10 @@ +