updated authentication classes
This commit is contained in:
@@ -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})
|
||||
|
||||
Reference in New Issue
Block a user