From 9df96086317c324b46b9eb9fecb031ec676e6c4f Mon Sep 17 00:00:00 2001 From: Maxim Kukhtenkov Date: Wed, 21 Dec 2016 11:40:18 -0800 Subject: [PATCH] Add `get_queryset` method to UserDetailsView due to issue with Swagger #275 --- rest_auth/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/rest_auth/views.py b/rest_auth/views.py index 5eaae6b..5aa7a70 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -3,6 +3,7 @@ from django.contrib.auth import ( logout as django_logout ) from django.conf import settings +from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext_lazy as _ @@ -130,6 +131,14 @@ class UserDetailsView(RetrieveUpdateAPIView): def get_object(self): return self.request.user + def get_queryset(self): + """ + Adding this method since it is sometimes called when using + django-rest-swagger + https://github.com/Tivix/django-rest-auth/issues/275 + """ + return get_user_model().objects.none() + class PasswordResetView(GenericAPIView):