-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added filter for expired and upcoming events
- Loading branch information
Showing
2 changed files
with
12 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
from django_filters.rest_framework import FilterSet | ||
|
||
from django_filters import filters | ||
from app.content.models.registration import Registration | ||
|
||
|
||
class RegistrationFilter(FilterSet): | ||
event_has_ended = filters.BooleanFilter(method="filter_event_has_ended") | ||
|
||
class Meta: | ||
model = Registration | ||
fields = ["has_attended", "is_on_wait"] | ||
|
||
def filter_event_has_ended(self, queryset, name, value): | ||
return queryset.filter( | ||
event_has_ended=value | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters