[Answered ]-Is it possible to use `__date` for a `timestamp` field in `filterset_fields` list of `DjangoFilterBackend`

1👍

Use a FilterSet class to create a filter with custom filters.

class ExpiredOrderFilter(filters.FilterSet):
    created_at__date = filters.DateFilter(field_name='created_at__date')

    class Meta:
        model = ExpiredOrder
        fields = ['created_at',]

Now instead of filterset_fields user filterset_class

filter_backends = [DjangoFilterBackend]
filterset_class = ExpiredOrderFilter

Leave a comment