Skip to content
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
9 changes: 9 additions & 0 deletions vacancy/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
from vacancy.models import Vacancy


def project_id_filter(queryset, name, value):
return queryset.filter(
**{
"project_id": value[0],
}
)


class VacancyFilter(filters.FilterSet):
"""Filter for Vacancies

Expand All @@ -25,6 +33,7 @@ def __init__(self, *args, **kwargs):
self.data["is_active"] = True

is_active = filters.BooleanFilter(field_name="is_active")
project = filters.Filter(method=project_id_filter)

class Meta:
model = Vacancy
Expand Down