from rest_framework import viewsets
from rest_framework.response import Response
from movies.models import Stars, Movies
from .serializer import StarsSerializer, MoviesSerializer
from rest_framework.authentication import TokenAuthentication, SessionAuthentication
from rest_framework.permissions import IsAuthenticated


class MoviesViewSet(viewsets.ModelViewSet):
    serializer_class = MoviesSerializer
    authentication_classes = (TokenAuthentication, SessionAuthentication)
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        movie = Movies.objects.all()
        return movie

class StarsViewSet(viewsets.ModelViewSet):
    serializer_class = StarsSerializer
    authentication_classes = (TokenAuthentication, SessionAuthentication)
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        star = Stars.objects.all()
        return star

from rest_framework import viewsets
from rest_framework.response import Response
from movies.models import Stars, Movies
from .serializer import StarsSerializer, MoviesSerializer
from rest_framework.authentication import TokenAuthentication, SessionAuthentication
from rest_framework.permissions import IsAuthenticated


class MoviesViewSet(viewsets.ModelViewSet):
    serializer_class = MoviesSerializer
    authentication_classes = (TokenAuthentication, SessionAuthentication)
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        movie = Movies.objects.all()
        return movie

class StarsViewSet(viewsets.ModelViewSet):
    serializer_class = StarsSerializer
    authentication_classes = (TokenAuthentication, SessionAuthentication)
    permission_classes = (IsAuthenticated,)

    def get_queryset(self):
        star = Stars.objects.all()
        return star
