forked from extern/django-helpdesk
Add ability to autoset custom fields in public ticket form
This commit is contained in:
parent
810184298f
commit
fbae218281
@ -21,7 +21,7 @@ from helpdesk.decorators import protect_view, is_helpdesk_staff
|
|||||||
import helpdesk.views.staff as staff
|
import helpdesk.views.staff as staff
|
||||||
from helpdesk.forms import PublicTicketForm
|
from helpdesk.forms import PublicTicketForm
|
||||||
from helpdesk.lib import text_is_spam
|
from helpdesk.lib import text_is_spam
|
||||||
from helpdesk.models import Ticket, Queue, UserSettings, KBCategory
|
from helpdesk.models import CustomField, Ticket, Queue, UserSettings, KBCategory
|
||||||
|
|
||||||
|
|
||||||
def create_ticket(request, *args, **kwargs):
|
def create_ticket(request, *args, **kwargs):
|
||||||
@ -83,6 +83,8 @@ class BaseCreateTicketView(FormView):
|
|||||||
initial_data['submitter_email'] = request.user.email
|
initial_data['submitter_email'] = request.user.email
|
||||||
|
|
||||||
query_param_fields = ['submitter_email', 'title', 'body']
|
query_param_fields = ['submitter_email', 'title', 'body']
|
||||||
|
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:
|
for qpf in query_param_fields:
|
||||||
initial_data[qpf] = request.GET.get(qpf, initial_data.get(qpf, ""))
|
initial_data[qpf] = request.GET.get(qpf, initial_data.get(qpf, ""))
|
||||||
return initial_data
|
return initial_data
|
||||||
|
Loading…
Reference in New Issue
Block a user