исправил запрос на проверку в избранном или нет
This commit is contained in:
parent
6cf0d304a7
commit
9a4f11969f
|
|
@ -33,10 +33,15 @@ class SongViewSet(GenericViewSet):
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
|
||||||
@action(detail=False, methods=['GET'], schema=DeleteSongSchema())
|
@action(
|
||||||
|
detail=False,
|
||||||
|
methods=['get'],
|
||||||
|
url_path='check_is_favorite/(?P<azura_id>[a-zA-Z0-9_]+)',
|
||||||
|
url_name='check_is_favorite',
|
||||||
|
)
|
||||||
def check_is_favorite(self, request):
|
def check_is_favorite(self, request):
|
||||||
try:
|
try:
|
||||||
song_obj = Song.objects.get(azura_id=request.data.get('song_id'))
|
song_obj = Song.objects.get(azura_id=request.data.get('azura_id'))
|
||||||
favorite_songs = FavoriteSong.objects.get(user=request.user, song=song_obj)
|
favorite_songs = FavoriteSong.objects.get(user=request.user, song=song_obj)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
return Response({"error": 'Объекта не существует'}, status=status.HTTP_404_NOT_FOUND)
|
return Response({"error": 'Объекта не существует'}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue