Could this configuration apply to DRF when django-rest-framework-gis is used for serializer ?
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',
'rest_framework.filters.SearchFilter'
)
my views.py :
class ReferenceGeoViewSet(viewsets.ReadOnlyModelViewSet):
"""
API endpoint that allows References to be listed as a GeoJson feature collection.
"""
queryset = Reference.objects.all().order_by('name')
filter_fields = ('id',)
search_fields = ('name', 'description')
pagination_class = None
serializer_class = ReferenceGeoSerializer
and my serializers.py :
from rest_framework_gis.serializers import GeoFeatureModelSerializer
class ReferenceGeoSerializer(GeoFeatureModelSerializer):
""" A class to serialize locations as GeoJSON compatible data """
class Meta:
model = Reference
geo_field = "geom_point"
fields = ('id', 'url', 'name', 'description', 'year', 'publication')
Trying to add filter as non GIS DRF ModelViewSet i can't get it working.