Rename function to make endpoint flow nicer.
This commit is contained in:
parent
6ce5b7ca65
commit
89d2616c65
1 changed files with 5 additions and 5 deletions
|
@ -43,7 +43,7 @@ class SongViewSet(viewsets.ModelViewSet):
|
||||||
return FullSongRetrieveSerializer
|
return FullSongRetrieveSerializer
|
||||||
return FullSongSerializer
|
return FullSongSerializer
|
||||||
|
|
||||||
def _change_artists(self, request, remove=False):
|
def _artists_change(self, request, remove=False):
|
||||||
song = self.get_object()
|
song = self.get_object()
|
||||||
serializer = SongArtistsListSerializer(data=request.data)
|
serializer = SongArtistsListSerializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
@ -62,9 +62,9 @@ class SongViewSet(viewsets.ModelViewSet):
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, permission_classes=[IsAdminUser])
|
@action(methods=['post'], detail=True, permission_classes=[IsAdminUser])
|
||||||
def add_artists(self, request, pk=None):
|
def artists_add(self, request, pk=None):
|
||||||
return self._change_artists(request)
|
return self._artists_change(request)
|
||||||
|
|
||||||
@action(methods=['post'], detail=True, permission_classes=[IsAdminUser])
|
@action(methods=['post'], detail=True, permission_classes=[IsAdminUser])
|
||||||
def remove_artists(self, request, pk=None):
|
def artists_remove(self, request, pk=None):
|
||||||
return self._change_artists(request, remove=True)
|
return self._artists_change(request, remove=True)
|
||||||
|
|
Loading…
Reference in a new issue