fix(public): Fix the public ticket creation by passing user or None to the form.save() method

This commit is contained in:
Arkadiy Korotaev 2020-07-20 16:43:55 +02:00
parent 34eb793f68
commit cf98b4a8e9
No known key found for this signature in database
GPG Key ID: 4BD092DD84540FAB

View File

@ -97,7 +97,7 @@ class BaseCreateTicketView(abstract_views.AbstractCreateTicketMixin, FormView):
# This submission is spam. Let's not save it.
return render(request, template_name='helpdesk/public_spam.html')
else:
ticket = form.save()
ticket = form.save(user=self.request.user if self.request.user.is_authenticated else None)
try:
return HttpResponseRedirect('%s?ticket=%s&email=%s&key=%s' % (
reverse('helpdesk:public_view'),