66from django .contrib .auth .models import User
77from django .utils .decorators import method_decorator
88from django .views .decorators .debug import sensitive_post_parameters
9+ from drf_yasg .openapi import IN_QUERY , TYPE_STRING , Parameter
10+ from drf_yasg .utils import swagger_auto_schema
911from rest_auth .registration .views import RegisterView as BaseRegisterView
1012from rest_auth .registration .views import SocialConnectView , SocialLoginView
1113from rest_framework .generics import RetrieveUpdateAPIView
2325 sensitive_post_parameters ("password" ), name = "dispatch"
2426)
2527
28+ email_param = Parameter (
29+ "email" ,
30+ IN_QUERY ,
31+ "Email belonging to the Profile's User instance" ,
32+ required = True ,
33+ type = TYPE_STRING ,
34+ )
35+
2636
2737class UpdateProfile (RetrieveUpdateAPIView ):
2838 """
@@ -45,6 +55,10 @@ def get_object(self):
4555
4656
4757class AdminUpdateProfile (RetrieveUpdateAPIView ):
58+ """
59+ Read or update user profiles
60+ """
61+
4862 serializer_class = ProfileSerializer
4963 queryset = Profile .objects .all ()
5064 permission_classes = (HasGroupPermission ,)
@@ -63,6 +77,18 @@ def get_object(self):
6377
6478 return None
6579
80+ @swagger_auto_schema (manual_parameters = [email_param ])
81+ def get (self , request , * args , ** kwargs ):
82+ return super ().get (request , * args , ** kwargs )
83+
84+ @swagger_auto_schema (manual_parameters = [email_param ])
85+ def patch (self , request , * args , ** kwargs ):
86+ return super ().get (request , * args , ** kwargs )
87+
88+ @swagger_auto_schema (manual_parameters = [email_param ])
89+ def put (self , request , * args , ** kwargs ):
90+ return super ().get (request , * args , ** kwargs )
91+
6692
6793class UserView (RetrieveUpdateAPIView ):
6894 queryset = User .objects .all ()
0 commit comments