Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added filter for allowed photos for user #794

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Loading