Django Rest Framework, passing parameters with GET request, classed based views

You can override get_queryset method for that purpose. As for query string parameters, you are right, holds POST data, you can get query string params through request.query_params

def get_queryset(self):
    longitude = self.request.query_params.get('longitude')
    latitude= self.request.query_params.get('latitude')
    radius = self.request.query_params.get('radius')

    location = Point(longitude, latitude)

    queryset = Model.objects.filter(location__distance_lte=(location, D(m=distance))).distance(location).order_by('distance')

    return queryset

Leave a Comment