We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Participant teams not showing up
The participant teams to which the user has been invited does not show up if that user logs in.

For instance: User A creates a team ABC and invites User B
User B logs in, and goes to  the participant teams page. 
User B does not see team ABC. 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `apps/participants/views.py`
Content:
```
1 from rest_framework import permissions, status
2 from rest_framework.decorators import (api_view,
3                                        authentication_classes,
4                                        permission_classes,
5                                        throttle_classes,)
6 from rest_framework.response import Response
7 from rest_framework_expiring_authtoken.authentication import (
8     ExpiringTokenAuthentication,)
9 from rest_framework.throttling import UserRateThrottle
10 
11 from accounts.permissions import HasVerifiedEmail
12 from base.utils import paginated_queryset
13 from challenges.models import Challenge
14 
15 from .models import (Participant, ParticipantTeam)
16 from .serializers import (InviteParticipantToTeamSerializer,
17                           ParticipantTeamSerializer,
18                           ChallengeParticipantTeam,
19                           ChallengeParticipantTeamList,
20                           ChallengeParticipantTeamListSerializer,)
21 
22 
23 @throttle_classes([UserRateThrottle])
24 @api_view(['GET', 'POST'])
25 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
26 @authentication_classes((ExpiringTokenAuthentication,))
27 def participant_team_list(request):
28 
29     if request.method == 'GET':
30         participant_teams = ParticipantTeam.objects.filter(
31             created_by=request.user)
32         paginator, result_page = paginated_queryset(participant_teams, request)
33         serializer = ParticipantTeamSerializer(result_page, many=True)
34         response_data = serializer.data
35         return paginator.get_paginated_response(response_data)
36 
37     elif request.method == 'POST':
38         serializer = ParticipantTeamSerializer(data=request.data,
39                                                context={'request': request})
40         if serializer.is_valid():
41             serializer.save()
42             response_data = serializer.data
43             participant_team = serializer.instance
44             participant = Participant(user=request.user,
45                                       status=Participant.SELF,
46                                       team=participant_team)
47             participant.save()
48             return Response(response_data, status=status.HTTP_201_CREATED)
49         return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
50 
51 
52 @throttle_classes([UserRateThrottle])
53 @api_view(['GET', 'PUT', 'PATCH', 'DELETE'])
54 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
55 @authentication_classes((ExpiringTokenAuthentication,))
56 def participant_team_detail(request, pk):
57 
58     try:
59         participant_team = ParticipantTeam.objects.get(pk=pk)
60     except ParticipantTeam.DoesNotExist:
61         response_data = {'error': 'ParticipantTeam does not exist'}
62         return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
63 
64     if request.method == 'GET':
65         serializer = ParticipantTeamSerializer(participant_team)
66         response_data = serializer.data
67         return Response(response_data, status=status.HTTP_200_OK)
68 
69     elif request.method in ['PUT', 'PATCH']:
70 
71         if request.method == 'PATCH':
72             serializer = ParticipantTeamSerializer(participant_team, data=request.data,
73                                                    context={
74                                                        'request': request},
75                                                    partial=True)
76         else:
77             serializer = ParticipantTeamSerializer(participant_team, data=request.data,
78                                                    context={'request': request})
79         if serializer.is_valid():
80             serializer.save()
81             response_data = serializer.data
82             return Response(response_data, status=status.HTTP_200_OK)
83         else:
84             return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
85 
86     elif request.method == 'DELETE':
87         participant_team.delete()
88         return Response(status=status.HTTP_204_NO_CONTENT)
89 
90 
91 @throttle_classes([UserRateThrottle])
92 @api_view(['POST'])
93 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
94 @authentication_classes((ExpiringTokenAuthentication,))
95 def invite_participant_to_team(request, pk):
96 
97     try:
98         participant_team = ParticipantTeam.objects.get(pk=pk)
99     except ParticipantTeam.DoesNotExist:
100         response_data = {'error': 'ParticipantTeam does not exist'}
101         return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
102 
103     serializer = InviteParticipantToTeamSerializer(data=request.data,
104                                                    context={'participant_team': participant_team,
105                                                             'request': request})
106     if serializer.is_valid():
107         serializer.save()
108         response_data = {
109             'message': 'User has been added successfully to the team'}
110         return Response(response_data, status=status.HTTP_202_ACCEPTED)
111     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
112 
113 
114 @throttle_classes([UserRateThrottle])
115 @api_view(['DELETE'])
116 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
117 @authentication_classes((ExpiringTokenAuthentication,))
118 def delete_participant_from_team(request, participant_team_pk, participant_pk):
119     """
120     Deletes a participant from a Participant Team
121     """
122     try:
123         participant_team = ParticipantTeam.objects.get(pk=participant_team_pk)
124     except ParticipantTeam.DoesNotExist:
125         response_data = {'error': 'ParticipantTeam does not exist'}
126         return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
127 
128     try:
129         participant = Participant.objects.get(pk=participant_pk)
130     except Participant.DoesNotExist:
131         response_data = {'error': 'Participant does not exist'}
132         return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
133 
134     if participant_team.created_by == request.user:
135 
136         if participant.user == request.user:  # when the user tries to remove himself
137             response_data = {
138                 'error': 'You are not allowed to remove yourself since you are admin. Please delete the team if you want to do so!'}  # noqa: ignore=E501
139             return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
140         else:
141             participant.delete()
142             return Response(status=status.HTTP_204_NO_CONTENT)
143     else:
144         response_data = {
145             'error': 'Sorry, you do not have permissions to remove this participant'}
146         return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)
147 
148 
149 @throttle_classes([UserRateThrottle])
150 @api_view(['GET', ])
151 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
152 @authentication_classes((ExpiringTokenAuthentication,))
153 def get_teams_and_corresponding_challenges_for_a_participant(request):
154     """
155     Returns list of teams and corresponding challenges for a participant
156     """
157     # first get list of all the participants and teams related to the user
158     participant_objs = Participant.objects.filter(user=request.user).prefetch_related('team')
159 
160     challenge_participated_teams = []
161     for participant_obj in participant_objs:
162         participant_team = participant_obj.team
163         try:
164             challenge = Challenge.objects.get(
165                 participant_teams=participant_team)
166         except Challenge.DoesNotExist:
167             challenge = None
168 
169         challenge_participated_teams.append(ChallengeParticipantTeam(
170             challenge, participant_team))
171 
172     serializer = ChallengeParticipantTeamListSerializer(ChallengeParticipantTeamList(challenge_participated_teams))
173     return Response(serializer.data, status=status.HTTP_200_OK)
174 
175 
176 @throttle_classes([UserRateThrottle])
177 @api_view(['DELETE', ])
178 @permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
179 @authentication_classes((ExpiringTokenAuthentication,))
180 def remove_self_from_participant_team(request, participant_team_pk):
181     """
182     A user can remove himself from the participant team.
183     """
184     try:
185         ParticipantTeam.objects.get(pk=participant_team_pk)
186     except ParticipantTeam.DoesNotExist:
187         response_data = {'error': 'ParticipantTeam does not exist'}
188         return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)
189 
190     try:
191         participant = Participant.objects.get(user=request.user.id, team__pk=participant_team_pk)
192         participant.delete()
193         return Response(status=status.HTTP_204_NO_CONTENT)
194     except:
195         response_data = {'error': 'Sorry, you do not belong to this team.'}
196         return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)
197
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/apps/participants/views.py b/apps/participants/views.py
--- a/apps/participants/views.py
+++ b/apps/participants/views.py
@@ -27,8 +27,9 @@
 def participant_team_list(request):
 
     if request.method == 'GET':
+        participant_teams_id = Participant.objects.filter(user_id=request.user).values_list('team_id', flat=True)
         participant_teams = ParticipantTeam.objects.filter(
-            created_by=request.user)
+            id__in=participant_teams_id)
         paginator, result_page = paginated_queryset(participant_teams, request)
         serializer = ParticipantTeamSerializer(result_page, many=True)
         response_data = serializer.data

{"golden_diff": "diff --git a/apps/participants/views.py b/apps/participants/views.py\n--- a/apps/participants/views.py\n+++ b/apps/participants/views.py\n@@ -27,8 +27,9 @@\n def participant_team_list(request):\n \n     if request.method == 'GET':\n+        participant_teams_id = Participant.objects.filter(user_id=request.user).values_list('team_id', flat=True)\n         participant_teams = ParticipantTeam.objects.filter(\n-            created_by=request.user)\n+            id__in=participant_teams_id)\n         paginator, result_page = paginated_queryset(participant_teams, request)\n         serializer = ParticipantTeamSerializer(result_page, many=True)\n         response_data = serializer.data\n", "issue": "Participant teams not showing up\nThe participant teams to which the user has been invited does not show up if that user logs in.\r\n\r\nFor instance: User A creates a team ABC and invites User B\r\nUser B logs in, and goes to  the participant teams page. \r\nUser B does not see team ABC. \n", "before_files": [{"content": "from rest_framework import permissions, status\nfrom rest_framework.decorators import (api_view,\n                                       authentication_classes,\n                                       permission_classes,\n                                       throttle_classes,)\nfrom rest_framework.response import Response\nfrom rest_framework_expiring_authtoken.authentication import (\n    ExpiringTokenAuthentication,)\nfrom rest_framework.throttling import UserRateThrottle\n\nfrom accounts.permissions import HasVerifiedEmail\nfrom base.utils import paginated_queryset\nfrom challenges.models import Challenge\n\nfrom .models import (Participant, ParticipantTeam)\nfrom .serializers import (InviteParticipantToTeamSerializer,\n                          ParticipantTeamSerializer,\n                          ChallengeParticipantTeam,\n                          ChallengeParticipantTeamList,\n                          ChallengeParticipantTeamListSerializer,)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', 'POST'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef participant_team_list(request):\n\n    if request.method == 'GET':\n        participant_teams = ParticipantTeam.objects.filter(\n            created_by=request.user)\n        paginator, result_page = paginated_queryset(participant_teams, request)\n        serializer = ParticipantTeamSerializer(result_page, many=True)\n        response_data = serializer.data\n        return paginator.get_paginated_response(response_data)\n\n    elif request.method == 'POST':\n        serializer = ParticipantTeamSerializer(data=request.data,\n                                               context={'request': request})\n        if serializer.is_valid():\n            serializer.save()\n            response_data = serializer.data\n            participant_team = serializer.instance\n            participant = Participant(user=request.user,\n                                      status=Participant.SELF,\n                                      team=participant_team)\n            participant.save()\n            return Response(response_data, status=status.HTTP_201_CREATED)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', 'PUT', 'PATCH', 'DELETE'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef participant_team_detail(request, pk):\n\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    if request.method == 'GET':\n        serializer = ParticipantTeamSerializer(participant_team)\n        response_data = serializer.data\n        return Response(response_data, status=status.HTTP_200_OK)\n\n    elif request.method in ['PUT', 'PATCH']:\n\n        if request.method == 'PATCH':\n            serializer = ParticipantTeamSerializer(participant_team, data=request.data,\n                                                   context={\n                                                       'request': request},\n                                                   partial=True)\n        else:\n            serializer = ParticipantTeamSerializer(participant_team, data=request.data,\n                                                   context={'request': request})\n        if serializer.is_valid():\n            serializer.save()\n            response_data = serializer.data\n            return Response(response_data, status=status.HTTP_200_OK)\n        else:\n            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n    elif request.method == 'DELETE':\n        participant_team.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['POST'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef invite_participant_to_team(request, pk):\n\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    serializer = InviteParticipantToTeamSerializer(data=request.data,\n                                                   context={'participant_team': participant_team,\n                                                            'request': request})\n    if serializer.is_valid():\n        serializer.save()\n        response_data = {\n            'message': 'User has been added successfully to the team'}\n        return Response(response_data, status=status.HTTP_202_ACCEPTED)\n    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['DELETE'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef delete_participant_from_team(request, participant_team_pk, participant_pk):\n    \"\"\"\n    Deletes a participant from a Participant Team\n    \"\"\"\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=participant_team_pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    try:\n        participant = Participant.objects.get(pk=participant_pk)\n    except Participant.DoesNotExist:\n        response_data = {'error': 'Participant does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    if participant_team.created_by == request.user:\n\n        if participant.user == request.user:  # when the user tries to remove himself\n            response_data = {\n                'error': 'You are not allowed to remove yourself since you are admin. Please delete the team if you want to do so!'}  # noqa: ignore=E501\n            return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n        else:\n            participant.delete()\n            return Response(status=status.HTTP_204_NO_CONTENT)\n    else:\n        response_data = {\n            'error': 'Sorry, you do not have permissions to remove this participant'}\n        return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', ])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef get_teams_and_corresponding_challenges_for_a_participant(request):\n    \"\"\"\n    Returns list of teams and corresponding challenges for a participant\n    \"\"\"\n    # first get list of all the participants and teams related to the user\n    participant_objs = Participant.objects.filter(user=request.user).prefetch_related('team')\n\n    challenge_participated_teams = []\n    for participant_obj in participant_objs:\n        participant_team = participant_obj.team\n        try:\n            challenge = Challenge.objects.get(\n                participant_teams=participant_team)\n        except Challenge.DoesNotExist:\n            challenge = None\n\n        challenge_participated_teams.append(ChallengeParticipantTeam(\n            challenge, participant_team))\n\n    serializer = ChallengeParticipantTeamListSerializer(ChallengeParticipantTeamList(challenge_participated_teams))\n    return Response(serializer.data, status=status.HTTP_200_OK)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['DELETE', ])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef remove_self_from_participant_team(request, participant_team_pk):\n    \"\"\"\n    A user can remove himself from the participant team.\n    \"\"\"\n    try:\n        ParticipantTeam.objects.get(pk=participant_team_pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    try:\n        participant = Participant.objects.get(user=request.user.id, team__pk=participant_team_pk)\n        participant.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n    except:\n        response_data = {'error': 'Sorry, you do not belong to this team.'}\n        return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)\n", "path": "apps/participants/views.py"}], "after_files": [{"content": "from rest_framework import permissions, status\nfrom rest_framework.decorators import (api_view,\n                                       authentication_classes,\n                                       permission_classes,\n                                       throttle_classes,)\nfrom rest_framework.response import Response\nfrom rest_framework_expiring_authtoken.authentication import (\n    ExpiringTokenAuthentication,)\nfrom rest_framework.throttling import UserRateThrottle\n\nfrom accounts.permissions import HasVerifiedEmail\nfrom base.utils import paginated_queryset\nfrom challenges.models import Challenge\n\nfrom .models import (Participant, ParticipantTeam)\nfrom .serializers import (InviteParticipantToTeamSerializer,\n                          ParticipantTeamSerializer,\n                          ChallengeParticipantTeam,\n                          ChallengeParticipantTeamList,\n                          ChallengeParticipantTeamListSerializer,)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', 'POST'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef participant_team_list(request):\n\n    if request.method == 'GET':\n        participant_teams_id = Participant.objects.filter(user_id=request.user).values_list('team_id', flat=True)\n        participant_teams = ParticipantTeam.objects.filter(\n            id__in=participant_teams_id)\n        paginator, result_page = paginated_queryset(participant_teams, request)\n        serializer = ParticipantTeamSerializer(result_page, many=True)\n        response_data = serializer.data\n        return paginator.get_paginated_response(response_data)\n\n    elif request.method == 'POST':\n        serializer = ParticipantTeamSerializer(data=request.data,\n                                               context={'request': request})\n        if serializer.is_valid():\n            serializer.save()\n            response_data = serializer.data\n            participant_team = serializer.instance\n            participant = Participant(user=request.user,\n                                      status=Participant.SELF,\n                                      team=participant_team)\n            participant.save()\n            return Response(response_data, status=status.HTTP_201_CREATED)\n        return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', 'PUT', 'PATCH', 'DELETE'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef participant_team_detail(request, pk):\n\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    if request.method == 'GET':\n        serializer = ParticipantTeamSerializer(participant_team)\n        response_data = serializer.data\n        return Response(response_data, status=status.HTTP_200_OK)\n\n    elif request.method in ['PUT', 'PATCH']:\n\n        if request.method == 'PATCH':\n            serializer = ParticipantTeamSerializer(participant_team, data=request.data,\n                                                   context={\n                                                       'request': request},\n                                                   partial=True)\n        else:\n            serializer = ParticipantTeamSerializer(participant_team, data=request.data,\n                                                   context={'request': request})\n        if serializer.is_valid():\n            serializer.save()\n            response_data = serializer.data\n            return Response(response_data, status=status.HTTP_200_OK)\n        else:\n            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n    elif request.method == 'DELETE':\n        participant_team.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['POST'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef invite_participant_to_team(request, pk):\n\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    serializer = InviteParticipantToTeamSerializer(data=request.data,\n                                                   context={'participant_team': participant_team,\n                                                            'request': request})\n    if serializer.is_valid():\n        serializer.save()\n        response_data = {\n            'message': 'User has been added successfully to the team'}\n        return Response(response_data, status=status.HTTP_202_ACCEPTED)\n    return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['DELETE'])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef delete_participant_from_team(request, participant_team_pk, participant_pk):\n    \"\"\"\n    Deletes a participant from a Participant Team\n    \"\"\"\n    try:\n        participant_team = ParticipantTeam.objects.get(pk=participant_team_pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    try:\n        participant = Participant.objects.get(pk=participant_pk)\n    except Participant.DoesNotExist:\n        response_data = {'error': 'Participant does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    if participant_team.created_by == request.user:\n\n        if participant.user == request.user:  # when the user tries to remove himself\n            response_data = {\n                'error': 'You are not allowed to remove yourself since you are admin. Please delete the team if you want to do so!'}  # noqa: ignore=E501\n            return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n        else:\n            participant.delete()\n            return Response(status=status.HTTP_204_NO_CONTENT)\n    else:\n        response_data = {\n            'error': 'Sorry, you do not have permissions to remove this participant'}\n        return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['GET', ])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef get_teams_and_corresponding_challenges_for_a_participant(request):\n    \"\"\"\n    Returns list of teams and corresponding challenges for a participant\n    \"\"\"\n    # first get list of all the participants and teams related to the user\n    participant_objs = Participant.objects.filter(user=request.user).prefetch_related('team')\n\n    challenge_participated_teams = []\n    for participant_obj in participant_objs:\n        participant_team = participant_obj.team\n        try:\n            challenge = Challenge.objects.get(\n                participant_teams=participant_team)\n        except Challenge.DoesNotExist:\n            challenge = None\n\n        challenge_participated_teams.append(ChallengeParticipantTeam(\n            challenge, participant_team))\n\n    serializer = ChallengeParticipantTeamListSerializer(ChallengeParticipantTeamList(challenge_participated_teams))\n    return Response(serializer.data, status=status.HTTP_200_OK)\n\n\n@throttle_classes([UserRateThrottle])\n@api_view(['DELETE', ])\n@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef remove_self_from_participant_team(request, participant_team_pk):\n    \"\"\"\n    A user can remove himself from the participant team.\n    \"\"\"\n    try:\n        ParticipantTeam.objects.get(pk=participant_team_pk)\n    except ParticipantTeam.DoesNotExist:\n        response_data = {'error': 'ParticipantTeam does not exist'}\n        return Response(response_data, status=status.HTTP_406_NOT_ACCEPTABLE)\n\n    try:\n        participant = Participant.objects.get(user=request.user.id, team__pk=participant_team_pk)\n        participant.delete()\n        return Response(status=status.HTTP_204_NO_CONTENT)\n    except:\n        response_data = {'error': 'Sorry, you do not belong to this team.'}\n        return Response(response_data, status=status.HTTP_401_UNAUTHORIZED)\n", "path": "apps/participants/views.py"}]}