spradio-server-django/savepointradio/api/views/radio.py

31 lines
918 B
Python
Raw Normal View History

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