mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-24 00:43:21 +01:00
Fix: Saving tickets with attachments disabled raises error
Exclude code where followups add their attachments to a new ticket. Make helper function _attach_files_to_follow_up() more robust.
This commit is contained in:
parent
20cd08fe28
commit
80ae20d1ac
@ -327,7 +327,7 @@ class AbstractTicketForm(CustomFieldMixin, forms.Form):
|
||||
return followup
|
||||
|
||||
def _attach_files_to_follow_up(self, followup):
|
||||
files = self.cleaned_data['attachment']
|
||||
files = self.cleaned_data.get('attachment')
|
||||
if files:
|
||||
files = process_attachments(followup, [files])
|
||||
return files
|
||||
@ -419,7 +419,10 @@ class TicketForm(AbstractTicketForm):
|
||||
followup = self._create_follow_up(ticket, title=title, user=user)
|
||||
followup.save()
|
||||
|
||||
files = self._attach_files_to_follow_up(followup)
|
||||
if settings.HELPDESK_ENABLE_ATTACHMENTS:
|
||||
files = self._attach_files_to_follow_up(followup)
|
||||
else:
|
||||
files = None
|
||||
|
||||
# emit signal when the TicketForm.save is done
|
||||
new_ticket_done.send(sender="TicketForm", ticket=ticket)
|
||||
|
Loading…
Reference in New Issue
Block a user