You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

14 lines
461 B

from rest_framework.renderers import JSONRenderer
from rest_framework.response import Response
from rest_framework.views import APIView
from library.models import Article
from library.serializers import ArticleSerializer
class LibraryListView(APIView):
renderer_classes = (JSONRenderer,)
status_code = 200
def get(self, request):
return Response([ArticleSerializer(i).data for i in Article.objects.filter(public=True)], self.status_code)