Prevent logout GET from getting documented by schema generation

...by preventing `get` from being implemented if
ACCOUNT_LOGOUT_ON_GET is False
This commit is contained in:
Steven Loria 2017-10-24 19:44:35 -04:00
parent 42d039b473
commit 76fd218958
No known key found for this signature in database
GPG Key ID: 631262B829DDB506

View File

@ -105,13 +105,10 @@ class LogoutView(APIView):
"""
permission_classes = (AllowAny,)
def get(self, request, *args, **kwargs):
if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False):
if getattr(settings, 'ACCOUNT_LOGOUT_ON_GET', False):
def get(self, request, *args, **kwargs):
response = self.logout(request)
else:
response = self.http_method_not_allowed(request, *args, **kwargs)
return self.finalize_response(request, response, *args, **kwargs)
return self.finalize_response(request, response, *args, **kwargs)
def post(self, request):
return self.logout(request)