Add get_queryset method to UserDetailsView due to issue with Swagger

#275
This commit is contained in:
Maxim Kukhtenkov 2016-12-21 11:40:18 -08:00
parent e81ed716ec
commit 9df9608631

View File

@ -3,6 +3,7 @@ from django.contrib.auth import (
logout as django_logout logout as django_logout
) )
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -130,6 +131,14 @@ class UserDetailsView(RetrieveUpdateAPIView):
def get_object(self): def get_object(self):
return self.request.user 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): class PasswordResetView(GenericAPIView):