diff --git a/memberportal/api_admin_tools/urls.py b/memberportal/api_admin_tools/urls.py index c7ed06d7..686c1489 100644 --- a/memberportal/api_admin_tools/urls.py +++ b/memberportal/api_admin_tools/urls.py @@ -5,6 +5,11 @@ urlpatterns = [ path("api/admin/members/", views.GetMembers.as_view(), name="GetMembers"), + # path( + # "api/admin/member//", + # views.MemberProfileByName.as_view(), + # name="MemberProfileByName", + # ), path( "api/admin/members//state//", views.MemberState.as_view(), diff --git a/memberportal/api_admin_tools/views.py b/memberportal/api_admin_tools/views.py index f04af07a..f784710b 100644 --- a/memberportal/api_admin_tools/views.py +++ b/memberportal/api_admin_tools/views.py @@ -41,12 +41,19 @@ class GetMembers(APIView): permission_classes = (permissions.IsAdminUser,) def get(self, request): - members = User.objects.select_related("profile").all() - filtered = [] - for member in members: + memberId = request.GET.get("memberId") + if memberId is not None: + member = User.objects.select_related("profile").get( + profile__screen_name=memberId + ) filtered.append(member.profile.get_basic_profile()) + else: + members = User.objects.select_related("profile").all() + + for member in members: + filtered.append(member.profile.get_basic_profile()) return Response(filtered)