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

Commit

Permalink
feat: implement status filter for Person
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Nov 14, 2023
1 parent 3c7e7cf commit 046a282
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions apis_ontology/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ def filter_empty_string(queryset, name, value):
value = ""
lookup = f"{name}__exact"
return queryset.filter(**{lookup: value})

def filter_status(queryset, name, value):
return queryset.filter(status__icontains=value)
3 changes: 2 additions & 1 deletion apis_ontology/settings/server_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@

APIS_RELATIONS_FILTER_EXCLUDE += ["annotation", "annotation_set_relation"]

from apis_ontology.filters import name_first_name_alternative_name_filter, name_alternative_name_filter, filter_empty_string
from apis_ontology.filters import name_first_name_alternative_name_filter, name_alternative_name_filter, filter_empty_string, filter_status
#INSTALLED_APPS.append("apis_highlighter")
def salarychoices():
from apis_ontology.models import Salary
Expand Down Expand Up @@ -160,6 +160,7 @@ def genderchoices():
"list_filters": {
"name": {"method": name_first_name_alternative_name_filter, "label": "Name or first name or alternative name"},
"gender": {"method": filter_empty_string, "extra": {"choices": genderchoices, "required": False}},
"status": {"method": filter_status},
},
"detail_view_exclude": detail_view_exclude,
},
Expand Down

0 comments on commit 046a282

Please sign in to comment.