Skip to content

Commit

Permalink
feat(filtersets): add a filter for multiple authors
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Jan 10, 2025
1 parent 84e65cd commit c8f12ac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apis_instance_nsvis/filtersets.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def filter(self, qs, value):
return qs.filter(internal_comment__isnull=not value)


class MultipleAuthors(BooleanFilter):
def filter(self, qs, value):
return qs.filter(author__len__gt=1)


class AnnotationFilterSet(FilterSet):
class Meta(AbstractEntityFilterSet.Meta):
unknown_field_behavior = UnknownFieldBehavior.IGNORE
Expand All @@ -67,3 +72,4 @@ def __init__(self, *args, **kwargs):
self.filters["topic"] = CustomMultipleChoiceFilter(field_name="topic")
self.filters["depicted"] = CustomMultipleChoiceFilter(field_name="depicted")
self.filters["internal_comment"] = InternalCommentExistsFilter(widget=CheckboxInput)
self.filters["multiple_authors"] = MultipleAuthors(widget=CheckboxInput)

0 comments on commit c8f12ac

Please sign in to comment.