File tree 3 files changed +9
-1
lines changed
3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change
1
+ import inspect
1
2
from django .contrib .admindocs .views import simplify_regex
2
3
3
4
@@ -24,7 +25,7 @@ def __get_allowed_methods__(self):
24
25
return [m .upper () for m in self .callback .cls .http_method_names if hasattr (self .callback .cls , m )]
25
26
26
27
def __get_docstring__ (self ):
27
- return self .callback . cls . __doc__
28
+ return inspect . getdoc ( self .callback )
28
29
29
30
def __get_serializer_fields__ (self ):
30
31
fields = []
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def test_index_view_with_endpoints(self):
33
33
self .assertEqual (response .context ["endpoints" ][0 ].name_parent , "accounts" )
34
34
self .assertEqual (response .context ["endpoints" ][0 ].allowed_methods , ['POST' , 'OPTIONS' ])
35
35
self .assertEqual (response .context ["endpoints" ][0 ].path , "/accounts/login/" )
36
+ self .assertEqual (response .context ["endpoints" ][0 ].docstring , "A view that allows users to login providing their username and password." )
36
37
self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 2 )
37
38
self .assertEqual (response .context ["endpoints" ][0 ].fields [0 ]["type" ], "CharField" )
38
39
self .assertTrue (response .context ["endpoints" ][0 ].fields [0 ]["required" ])
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ class TestView(TemplateView):
20
20
21
21
22
22
class LoginView (APIView ):
23
+ """
24
+ A view that allows users to login providing their username and password.
25
+ """
23
26
24
27
throttle_classes = ()
25
28
permission_classes = ()
@@ -42,6 +45,9 @@ class UserRegistrationView(generics.CreateAPIView):
42
45
43
46
44
47
class UserProfileView (generics .RetrieveUpdateAPIView ):
48
+ """
49
+ An endpoint for users to view and update their profile information.
50
+ """
45
51
46
52
serializer_class = serializers .UserProfileSerializer
47
53
You can’t perform that action at this time.
0 commit comments