Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Add public activity filters (#1292)
Browse files Browse the repository at this point in the history
* Update dev container image versions

* Improve public activity filtering
  • Loading branch information
nicksellen authored Mar 18, 2024
1 parent 1d3d9e6 commit e1e790d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion karrot/activities/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class PublicActivityViewSet(
mixins.ListModelMixin,
):
serializer_class = PublicActivitySerializer
queryset = ActivityModel.objects.is_public().exclude_disabled()
queryset = ActivityModel.objects.is_public().exclude_disabled().filter(place__archived_at__isnull=True)
filter_backends = (
filters.DjangoFilterBackend,
OrderingFilter,
Expand Down
11 changes: 11 additions & 0 deletions karrot/activities/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ class Meta:
class PublicActivitiesFilter(filters.FilterSet):
group = filters.NumberFilter(field_name="place__group")
date = ISODateTimeRangeFromToRangeFilter(field_name="date", lookup_expr="overlap")
place = filters.NumberFilter(field_name="place")
activity_type = filters.NumberFilter(field_name="activity_type")

class Meta:
model = Activity
fields = [
"group",
"date",
"place",
"activity_type",
]


def place_status_queryset(request):
Expand Down

0 comments on commit e1e790d

Please sign in to comment.