From 20b4f0bf6a6726ea3d553f52f58f62fede987349 Mon Sep 17 00:00:00 2001 From: Jacobjohnjeevan Date: Tue, 7 Jan 2025 20:59:42 +0530 Subject: [PATCH] add username search for facility users --- care/emr/api/viewsets/facility.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/care/emr/api/viewsets/facility.py b/care/emr/api/viewsets/facility.py index 94bf38fadf..8de6c414fe 100644 --- a/care/emr/api/viewsets/facility.py +++ b/care/emr/api/viewsets/facility.py @@ -107,10 +107,14 @@ def get_queryset(self): ).values("user_id") ) +class FacilityUserFilter(FilterSet): + username = CharFilter(field_name="username", lookup_expr="icontains") class FacilityUsersViewSet(EMRModelReadOnlyViewSet): database_model = User pydantic_read_model = UserSpec + filterset_class = FacilityUserFilter + filter_backends = [DjangoFilterBackend] def get_queryset(self): return User.objects.filter(