Fix field hiding and setting code for ticket submition qargs

This commit is contained in:
Timothy Hobbs 2020-01-06 14:13:31 +01:00
parent 8f59bfcc3c
commit 606098d947
2 changed files with 3 additions and 4 deletions

View File

@ -349,10 +349,9 @@ 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():
for field in self.fields.keys():
setting = field_hide_table.get(field, None)
if (setting and hasattr(settings, setting)) or field in hidden_fields:
self.fields[field].widget = forms.HiddenInput()

View File

@ -82,7 +82,7 @@ class BaseCreateTicketView(FormView):
if request.user.is_authenticated and request.user.email:
initial_data['submitter_email'] = request.user.email
query_param_fields = ['submitter_email', 'title', 'body']
query_param_fields = ['submitter_email', 'title', 'body', 'queue']
custom_fields = ["custom_%s" % f.name for f in CustomField.objects.filter(staff_only=False)]
query_param_fields += custom_fields
for qpf in query_param_fields: