добавил пермишн на метод ретрив
This commit is contained in:
parent
111e948b3f
commit
ccf37f2e49
|
|
@ -4,6 +4,7 @@ from rest_framework.response import Response
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
from rest_framework.permissions import IsAuthenticated
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from .schemas import SongSchema, DeleteSongSchema
|
from .schemas import SongSchema, DeleteSongSchema
|
||||||
|
|
@ -11,6 +12,9 @@ from .models import Song, FavoriteSong
|
||||||
from .serializers import SongSerializer, FavoriteSongSerializer
|
from .serializers import SongSerializer, FavoriteSongSerializer
|
||||||
|
|
||||||
class SongViewSet(ViewSet):
|
class SongViewSet(ViewSet):
|
||||||
|
permission_classes_by_action = {
|
||||||
|
'retrieve': [IsAuthenticated],
|
||||||
|
}
|
||||||
def list(self, request):
|
def list(self, request):
|
||||||
queryset = Song.objects.all()
|
queryset = Song.objects.all()
|
||||||
serializer = SongSerializer(queryset, many=True)
|
serializer = SongSerializer(queryset, many=True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue