[Answered ]-Django filter for not null

1👍

Try this:

class MessageFilterSet(filters.FilterSet):
    seen = filters.BooleanFilter(field_name="seen_at", lookup_expr="isnull", exclude = True)

From Django Filter Reference Docs:

exclude

A boolean that specifies whether the Filter should use filter
or exclude on the queryset. Defaults to False.

Leave a comment