Default authentication on endpoints

Ik was er namelijk alweer eentje vergeten dus heh.
This commit is contained in:
2025-05-22 22:30:06 +02:00
parent ce06b16881
commit a54f8947bb
6 changed files with 5 additions and 30 deletions
-6
View File
@@ -1,15 +1,11 @@
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 Track, Profile
from playlist.serializers import TrackSerializer
from playlist.spotify import spt
from playlist.tasks import get_banter, get_and_dither_image
class TrackListView(APIView):
authentication_classes = [SessionAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request):
tracks = Track.objects.all()
serializer = TrackSerializer(tracks, many=True, context={'request': request})
@@ -32,8 +28,6 @@ class TrackListView(APIView):
return Response({'error': 'Only superusers can delete all tracks'}, status=403)
class TrackDetailView(APIView):
authentication_classes = [SessionAuthentication]
permission_classes = [IsAuthenticated]
def get(self, request, id):
track = Track.objects.get(pk=id)
serializer = TrackSerializer(track, context={'request': request})