Default authentication on endpoints
Ik was er namelijk alweer eentje vergeten dus heh.
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user