2018-03-28 20:12:55 +00:00
|
|
|
from rest_framework import viewsets
|
|
|
|
|
|
|
|
from radio.models import Album, Artist, Game, Song
|
2018-03-28 20:56:53 +00:00
|
|
|
from ..permissions import IsAdminOrReadOnly
|
2018-03-28 20:12:55 +00:00
|
|
|
from ..serializers.radio import (AlbumSerializer, ArtistSerializer,
|
|
|
|
GameSerializer, SongSerializer)
|
|
|
|
|
|
|
|
|
|
|
|
class AlbumViewSet(viewsets.ModelViewSet):
|
2018-03-28 20:56:53 +00:00
|
|
|
permission_classes = [IsAdminOrReadOnly]
|
2018-03-28 20:12:55 +00:00
|
|
|
queryset = Album.objects.all()
|
|
|
|
serializer_class = AlbumSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class ArtistViewSet(viewsets.ModelViewSet):
|
2018-03-28 20:56:53 +00:00
|
|
|
permission_classes = [IsAdminOrReadOnly]
|
2018-03-28 20:12:55 +00:00
|
|
|
queryset = Artist.objects.all()
|
|
|
|
serializer_class = ArtistSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class GameViewSet(viewsets.ModelViewSet):
|
2018-03-28 20:56:53 +00:00
|
|
|
permission_classes = [IsAdminOrReadOnly]
|
2018-03-28 20:12:55 +00:00
|
|
|
queryset = Game.objects.all()
|
|
|
|
serializer_class = GameSerializer
|
|
|
|
|
|
|
|
|
|
|
|
class SongViewSet(viewsets.ModelViewSet):
|
2018-03-28 20:56:53 +00:00
|
|
|
permission_classes = [IsAdminOrReadOnly]
|
2018-03-28 20:12:55 +00:00
|
|
|
queryset = Song.objects.all()
|
|
|
|
serializer_class = SongSerializer
|