Skip to content

Instantly share code, notes, and snippets.

Last active Nov 23, 2020
What would you like to do?
from rest_framework.response import Response
from rest_framework.views import APIView
from rest_framework_xml.renderers import XMLRenderer
from student.models import School
from student.serializers import SchoolListSerializer
class SchoolView(APIView):
renderer_classes = [XMLRenderer, ]
def get(self, request):
schools = School.objects.all()
school_serializer = SchoolListSerializer(schools, many=True)
return Response(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment