Answers for "queryset.raw() in django rest framework joining tables"

0

queryset.raw() in django rest framework joining tables

class MyModelViewSet(viewsets.ModelViewSet):
    # The usual stuff here
    model = MyModel

    def list(self, request):
        queryset = MyModel.objects.raw('... your SQL here...')
        serializer = MyModelSerializer(queryset, many=True)
        return Response(serializer.data)
Posted by: Guest on October-21-2021

Code answers related to "queryset.raw() in django rest framework joining tables"

Python Answers by Framework

Browse Popular Code Answers by Language