Skip to content

Commit 856b989

Browse files
authored
Merge pull request #1 from Eerie16/backend
Fix for Swagger warnings
2 parents 2613080 + cc5bce9 commit 856b989

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

website/views.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def post(self, request, *args, **kwargs):
7070
class TeamLeaveView(generics.DestroyAPIView):
7171
permission_classes = [permissions.IsAuthenticated, AllowCompleteAndVerified]
7272
authentication_classes = [authentication.TokenAuthentication, authentication.SessionAuthentication]
73-
lookup_url_kwarg = 'pk'
73+
lookup_field = 'pk'
7474
queryset = Team.objects.all()
7575

7676
def perform_destroy(self, instance):
@@ -90,10 +90,16 @@ def destroy(self, request, *args, **kwargs):
9090
class RemoveFromTeamView(generics.GenericAPIView):
9191
permission_classes = [permissions.IsAuthenticated, AllowCompleteAndVerified]
9292
authentication_classes = [authentication.TokenAuthentication, authentication.SessionAuthentication]
93-
lookup_url_kwarg = 'pk'
93+
lookup_field = 'pk'
9494
queryset = Team.objects.all()
9595
serializer_class = RemoveFromTeamSerializer
9696

97+
98+
def get_object(self):
99+
if getattr(self, 'swagger_fake_view', False):
100+
return None
101+
return super().get_object()
102+
97103
def get_serializer_context(self):
98104
"""
99105
Extra context provided to the serializer class.

0 commit comments

Comments
 (0)