Fix a bug when assigned_to or merged_to were not passed in body

This commit is contained in:
Benbb96 2022-04-07 00:42:12 +02:00
parent 2b33de6b37
commit 88b234958a

View File

@ -93,9 +93,9 @@ class TicketSerializer(serializers.ModelSerializer):
data['body'] = data['description'] data['body'] = data['description']
# TicketForm needs id for ForeignKey (not the instance themselves) # TicketForm needs id for ForeignKey (not the instance themselves)
data['queue'] = data['queue'].id data['queue'] = data['queue'].id
if data['assigned_to']: if data.get('assigned_to'):
data['assigned_to'] = data['assigned_to'].id data['assigned_to'] = data['assigned_to'].id
if data['merged_to']: if data.get('merged_to'):
data['merged_to'] = data['merged_to'].id data['merged_to'] = data['merged_to'].id
ticket_form = TicketForm(data=data, queue_choices=queue_choices) ticket_form = TicketForm(data=data, queue_choices=queue_choices)