Skip to content

Instantly share code, notes, and snippets.

@Allwin12

Allwin12/views.py

Last active Nov 23, 2020
Embed
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(school_serializer.data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.