from rest_framework.generics import ListAPIView, RetrieveAPIView, get_object_or_404
from rest_framework.permissions import DjangoModelPermissionsOrAnonReadOnly
from rest_framework.response import Response
from rest_framework.generics import ListAPIView, RetrieveAPIView, get_object_or_404
from rest_framework.permissions import DjangoModelPermissionsOrAnonReadOnly
from rest_framework.response import Response
class EbookList(BookList):
serializer_class = serializers.EbookSerializer
@vary_on_auth # Because of 'liked'.
class Preview(ListAPIView):
class EbookList(BookList):
serializer_class = serializers.EbookSerializer
@vary_on_auth # Because of 'liked'.
class Preview(ListAPIView):
def get(self, *args, **kwargs):
return HttpResponse(self.get_object().get_media('epub'))
def get(self, *args, **kwargs):
return HttpResponse(self.get_object().get_media('epub'))