I’m attempting to use an instance of django-filter’s DateTimeFromToRangeFilter in conjunction with a custom FilterSet
. However, this does not work when I attempt to do the following:
class CustomFilterSet(FilterSet):
modified = django_filters.IsoDateTimeFromToRangeFilter()
class Meta:
fields = "__all__"
model = Custom
This does not result in additional fields or annotations being created, like I’d expect based on the docs. Something like:
f = F({'modified_after': '...', 'modified_before': '...'})
If I inspect the single field (modified
) which has been added to my DjangoFilterConnectionField, I see the following:
{'creation_counter': 395, 'name': None, '_type': <String meta=<ScalarOptions name='String'>>, 'default_value': Undefined, 'description': None, 'deprecation_reason': None}
So, how do I configure this filter such that I can write a query like the following?
query {
allTheSmallThings(
modified_before: "2023-09-26 17:21:22.921692+00:00"
) {
edges {
node {
id
}
}
}
}