class filter(filters.FilterSet):
filename = django_filters.CharFilter(name='filename', lookup_expr='contains')
state = django_filters.filters.ModelMultipleChoiceFilter(
name='state_id',
to_field_name ='state' ,
queryset=models.IngestionState.objects.all())
http://localhost:8000/ingestion-detail/?filename="{something}"&status=
The above URL gives empty result.
Only when status = {something} we are getting the required result. This is case specific to ModelMultipleChoiceFilter only
Well, difficult to help with what you've said.
'status' != 'state'
but I assume that's a typo.
Try from django_filters.constants import STRICTNESS
and set the strict
meta option to STRICTNESS.RAISE_VALIDATION_ERROR
. That should at least tell you something.
Otherwise I'll need you to try and identify something much more specific before I can consider this an Issue. Maybe StackOverflow would suit you better if you just need help.
HI锛孖 had the same problem , in this situation ,how to fix the empty result if ,my url had the status=blank, if i want the status in all possible?
from django_filters.constants import STRICTNESS
this showing me error called ImportError: cannot import name 'STRICTNESS'
Most helpful comment
from django_filters.constants import STRICTNESS
this showing me error calledImportError: cannot import name 'STRICTNESS'