class LocationListAPIView(generics.ListAPIView):
    queryset = Location.objects.all()
serializer_class = LocationSerializer


class LocationDetailAPIView(generics.RetrieveAPIView):
    queryset = Location.objects.all()
serializer_class = LocationSerializer
How to get a response of multiple objects using rest_framework and Django