Is there a way to add a filter to queryset for a specific ordering field like "created" in OrderingFilter? I want to have this filter for ordering:
F('created').desc(nulls_last=True)
Here is my code:
class ProductFilter(filters.FilterSet):
ordering = filters.OrderingFilter(fields=['price', 'created'])
class Meta:
model = Product
class Metayou must to havefieldsproperty and pass all fields that you want to filter . There you can define extra fields too