Is there a way to declare exclude filters in Meta?

13 views
Skip to first unread message

Bernhard Mäder

unread,
May 20, 2020, 3:44:29 AM5/20/20
to django-filter
Hey y'all

I'm looking for a way to have negative or excluding filters, which are possible to declare like this:


    not_created__gt
= rest_framework_filters.DateFilter(
        field_name
="created", exclude=True, lookup_expr='gt')
    not_created__lt
= rest_framework_filters.DateFilter(
        field_name
="created", exclude=True, lookup_expr='lt')



... but not on Meta. I was hoping I could do something like this:


   
class Meta:
        fields
= {
           
"-created": ["lt", "gt"],
       
}


My use case is filtering nullable date values, in which case exclude() is so very valuable.
Reply all
Reply to author
Forward
0 new messages