From ff10ec3a9837cf1d0de98b1204e232bb148f3fce Mon Sep 17 00:00:00 2001 From: albertoleoncio Date: Tue, 2 Jul 2024 21:57:03 -0300 Subject: [PATCH] feat: Update UsersByTagViewSet to include wikimedia_project tag type --- users/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/users/views.py b/users/views.py index 31b255f..233fe34 100644 --- a/users/views.py +++ b/users/views.py @@ -98,7 +98,7 @@ def list(self, request, *args, **kwargs): return Response(response, status=status.HTTP_400_BAD_REQUEST) -# Class to list users by "tags" (skills, languages, territories, projects, affiliation) with format /tags/// +# Class to list users by "tags" (skills, languages, territories, wikimedia_project, affiliation) with format /tags/// # Example: /tags/project/1/ class UsersByTagViewSet(viewsets.ReadOnlyModelViewSet): queryset = Profile.objects.all() @@ -127,7 +127,7 @@ def retrieve(self, request, *args, **kwargs): elif tag_type == 'territory': users = Profile.objects.filter(territory=tag_id) data = [{'id': user.id, 'display_name': user.display_name, 'username': user.user.username, 'profile_image': user.profile_image} for user in users] - elif tag_type == 'project': + elif tag_type == 'wikimedia_project': users = Profile.objects.filter(wikimedia_project=tag_id) data = [{'id': user.id, 'display_name': user.display_name, 'username': user.user.username, 'profile_image': user.profile_image} for user in users] elif tag_type == 'affiliation': @@ -140,5 +140,5 @@ def retrieve(self, request, *args, **kwargs): return Response(data) def list(self, request, *args, **kwargs): - response = {'message': 'Please provide a tag type and a tag id. Options are: skill, language, territory, project, affiliation.'} + response = {'message': 'Please provide a tag type and a tag id. Options are: skill, language, territory, wikimedia_project, affiliation.'} return Response(response, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file