mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-26 16:48:50 +01:00
Enable better ticket form pre-filling
This commit is contained in:
parent
9fd104af89
commit
1c24d88680
11
docs/integration.txt
Normal file
11
docs/integration.txt
Normal file
@ -0,0 +1,11 @@
|
||||
Integrating django-helpdesk into your application
|
||||
-------------------------------------------------
|
||||
|
||||
Django-helpdesk associates an email address with each submitted ticket. If you integrate django-helpdesk directly into your django application, logged in users will automatically have their email address set when they visit the `/tickets/submit/` form. If you wish to pre-fill fields in this form, you can do so simply by setting the following query parameters:
|
||||
|
||||
- `queue`
|
||||
- `title`
|
||||
- `body`
|
||||
- `submitter_email`
|
||||
|
||||
Note that these fields will continue to be user-editable despite being pre-filled.
|
@ -87,6 +87,10 @@ class CreateTicketView(FormView):
|
||||
|
||||
if request.user.is_authenticated and request.user.email:
|
||||
initial_data['submitter_email'] = request.user.email
|
||||
|
||||
query_param_fields = ['submitter_email', 'title', 'body']
|
||||
for qpf in query_param_fields:
|
||||
initial_data[qpf] = request.GET.get(qpf, initial_data.get(qpf, ""))
|
||||
return initial_data
|
||||
|
||||
def form_valid(self, form):
|
||||
|
Loading…
Reference in New Issue
Block a user