From 3c1a7e6f7fb58e4b29f441928168bfc917b2948d Mon Sep 17 00:00:00 2001 From: Ankur Date: Wed, 24 Jan 2024 23:25:18 +0100 Subject: [PATCH] Tickets done --- src/events/views/api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/events/views/api.py b/src/events/views/api.py index 8e549e45..cbdc7fd6 100644 --- a/src/events/views/api.py +++ b/src/events/views/api.py @@ -1,6 +1,6 @@ from rest_framework import viewsets from events.serializers.serializers import * -from rest_framework.permissions import IsAuthenticatedOrReadOnly +from rest_framework.permissions import IsAuthenticatedOrReadOnly, AllowAny, IsAuthenticated from events.models.costs import Costs from events.models.event import Event from events.models.participant import Participant @@ -10,7 +10,7 @@ class CostsViewSet(viewsets.ReadOnlyModelViewSet): serializer_class = CostsSerializer - permission_classes = [IsAuthenticatedOrReadOnly] + permission_classes = [AllowAny] queryset = Costs.objects.all() class EventViewSet(viewsets.ReadOnlyModelViewSet): @@ -34,6 +34,10 @@ def get_queryset(self): class TicketViewSet(viewsets.ReadOnlyModelViewSet): serializer_class = TicketSerializer - permission_classes = [IsAuthenticatedOrReadOnly] - queryset = Ticket.objects.all() + permission_classes = [IsAuthenticated] + + def get_queryset(self): + user = self.request.user + queryset = EventApplication.objects.filter(owner=user) + return queryset