From 88b234958a2fc7aeb2b915249a7a7bc89690ab47 Mon Sep 17 00:00:00 2001 From: Benbb96 Date: Thu, 7 Apr 2022 00:42:12 +0200 Subject: [PATCH] Fix a bug when assigned_to or merged_to were not passed in body --- helpdesk/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpdesk/serializers.py b/helpdesk/serializers.py index 3d7b61fd..7852f620 100644 --- a/helpdesk/serializers.py +++ b/helpdesk/serializers.py @@ -93,9 +93,9 @@ class TicketSerializer(serializers.ModelSerializer): data['body'] = data['description'] # TicketForm needs id for ForeignKey (not the instance themselves) data['queue'] = data['queue'].id - if data['assigned_to']: + if data.get('assigned_to'): data['assigned_to'] = data['assigned_to'].id - if data['merged_to']: + if data.get('merged_to'): data['merged_to'] = data['merged_to'].id ticket_form = TicketForm(data=data, queue_choices=queue_choices)