class GeoModelViewSet(viewsets.ModelViewSet):
queryset = Geo.objects.all()
serializer_class = GeoSerializerSmall
distance_filter_field = 'location'
filter_backend = (DistanceToPointFilter, )
def list(self, request):
queryset = Geo.objects.all()
queryset = GeoFilter(request.GET, queryset=queryset)
serializer = NDTSerializerSmall(queryset, many=True)
return Response(serializer.data)
Although the example on the documentation look very simple, but we don't have any clue how we should modify our view or seriallizer to get this working. We even checked the filter.py on Github and it made sense to us how you have imeplemented the distance filter but we don't know the exact syntax of applying the filter to our data.
Thanks for you help.