I have the following URL query -
http://localhost:8000/api/passenger-census/?public_location_description==SW%206th%20&%20Salmon
however, the spaces are not being decoded and the resulting query that django parses is
GET /api/passenger-census/?public_location_description=SW%206th%20&%20Salmon
which returns a null since the string to be found is "SW 6th & Salmon".
Django code
views.py -
class PassengerCensusViewSet(viewsets.ModelViewSet):
queryset = PassengerCensus.objects.all()
serializer_class = PassengerCensusSerializer
filter_backends = (SearchFilter,DjangoFilterBackend,OrderingFilter,)
search_fields = ('route_number', 'direction','service_key','stop_seq',
'location_id','public_location_description',)
filter_fields = ('summary_begin_date','route_number','direction','service_key','stop_seq','location_id',
'public_location_description','ons','offs','x_coord','y_coord','geom_2913','geom_4326',)
ordering_fields = '__all__'
serializer.py
class PassengerCensusSerializer(serializers.ModelSerializer):
class Meta:
model = PassengerCensus
fields = '__all__'
What is the issue here?
+, not%20.