From fdefcb827ab020cae9ea2ebc837d5a80ef498c40 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 12 Dec 2024 20:31:53 +0100 Subject: [PATCH] Change reserve ticket view to use the id instead of ticket name when getting tickets. --- backend/bittan/bittan/views/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/bittan/bittan/views/views.py b/backend/bittan/bittan/views/views.py index bfaef75..04e8f9a 100644 --- a/backend/bittan/bittan/views/views.py +++ b/backend/bittan/bittan/views/views.py @@ -22,7 +22,7 @@ import logging class TicketsSerializer(serializers.Serializer): - ticket_type = serializers.CharField(required=True) + ticket_type = serializers.IntegerField(required=True) count = serializers.IntegerField(required=True, min_value=1) class ReserveTicketRequestSerializer(serializers.Serializer): @@ -77,7 +77,7 @@ def reserve_ticket(request: Request) -> Response: for ticket in tickets: try: - ticket_type = TicketType.objects.get(title=ticket["ticket_type"], is_visible=True) + ticket_type = TicketType.objects.get(pk=ticket["ticket_type"], is_visible=True) except ObjectDoesNotExist: return Response( "TicketTypeDoesNotExist",