From 38cedca5416b2f995677ea9518fb5661fab6dd82 Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Thu, 12 Dec 2019 17:22:57 +0100 Subject: [PATCH] Can now hide custom fields using query param in public ticket form --- helpdesk/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helpdesk/forms.py b/helpdesk/forms.py index 35d67046..6d3f5abb 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -349,8 +349,11 @@ class PublicTicketForm(AbstractTicketForm): 'priority': 'HELPDESK_PUBLIC_TICKET_PRIORITY', 'due_date': 'HELPDESK_PUBLIC_TICKET_DUE_DATE', } + for cf in CustomField.objects.filter(staff_only=False): + field_hide_table["custom_%s" % cf.name] = None + for (field, setting) in field_hide_table.items(): - if hasattr(settings, setting) or field in hidden_fields: + if (setting and hasattr(settings, setting)) or field in hidden_fields: self.fields[field].widget = forms.HiddenInput() self.fields['queue'].choices = [('', '--------')] + [