Skip to content

Commit

Permalink
added filter for allowed photos for user (#794)
Browse files Browse the repository at this point in the history
added filter for allowed photos
  • Loading branch information
MadsNyl authored Apr 17, 2024
1 parent 3f56496 commit 064da8a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/content/filters/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class UserFilter(FilterSet):
)
in_group = CharFilter(method="filter_is_in_group", label="Only list users in group")

has_allowed_photo = BooleanFilter(
method="filter_has_allowed_photo", label="Has allowed photo"
)

class Meta:
model: User
fields = [
Expand Down Expand Up @@ -52,3 +56,6 @@ def filter_has_active_strikes(self, queryset, name, value):
if value is False:
return queryset.exclude(strikes__in=Strike.objects.active()).distinct()
return queryset.filter(strikes__in=Strike.objects.active()).distinct()

def filter_has_allowed_photo(self, queryset, name, value):
return queryset.filter(allows_photo_by_default=value)

0 comments on commit 064da8a

Please sign in to comment.