updated authentication classes

This commit is contained in:
2025-06-20 14:37:34 +02:00
parent 970eb9e19e
commit 3576d85ac9
3 changed files with 76 additions and 75 deletions
-8
View File
@@ -1,15 +1,10 @@
from django.db import IntegrityError
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from playlist.models import Vote, Profile
from playlist.serializers import VoteSerializer, VoteSaveSerializer
class VoteListView(APIView):
authentication_classes = [SessionAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request, user_id = None):
if user_id:
votes = Vote.objects.filter(user_id=user_id)
@@ -39,9 +34,6 @@ class VoteListView(APIView):
return Response(status=403)
class VoteDetailView(APIView):
authentication_classes = [SessionAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request, id):
vote = Vote.objects.get(pk=id)
serializer = VoteSerializer(vote, context={'request': request})