Skip to content

Commit

Permalink
feat: sw team query
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv9449 committed Mar 14, 2024
1 parent 279cd25 commit f283583
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions student_welfare_backend/student_welfare_backend/users/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ def get_serializer_class(self):
if self.action == "list":
return UserAdminListSerializer
return UserAdminSerializer

def get_queryset(self):
queryset = super().get_queryset()

# Filter based on query parameters
filter_params = self.request.query_params
if "sw_team" in filter_params:
queryset = self.get_sw_team()
return queryset

def get_sw_team(self):
"""
Returns users with is_dsw and is_adsw
"""
sw_team = self.queryset.filter(is_dsw=True, is_adsw=True)
return sw_team


class UserBulkUploadView(BaseBulkUploadView):
Expand Down

0 comments on commit f283583

Please sign in to comment.