File tree Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Expand file tree Collapse file tree 3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1+ import inspect
12from django .contrib .admindocs .views import simplify_regex
23
34
@@ -24,7 +25,7 @@ def __get_allowed_methods__(self):
2425 return [m .upper () for m in self .callback .cls .http_method_names if hasattr (self .callback .cls , m )]
2526
2627 def __get_docstring__ (self ):
27- return self .callback . cls . __doc__
28+ return inspect . getdoc ( self .callback )
2829
2930 def __get_serializer_fields__ (self ):
3031 fields = []
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ def test_index_view_with_endpoints(self):
3333 self .assertEqual (response .context ["endpoints" ][0 ].name_parent , "accounts" )
3434 self .assertEqual (response .context ["endpoints" ][0 ].allowed_methods , ['POST' , 'OPTIONS' ])
3535 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." )
3637 self .assertEqual (len (response .context ["endpoints" ][0 ].fields ), 2 )
3738 self .assertEqual (response .context ["endpoints" ][0 ].fields [0 ]["type" ], "CharField" )
3839 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):
2020
2121
2222class LoginView (APIView ):
23+ """
24+ A view that allows users to login providing their username and password.
25+ """
2326
2427 throttle_classes = ()
2528 permission_classes = ()
@@ -42,6 +45,9 @@ class UserRegistrationView(generics.CreateAPIView):
4245
4346
4447class UserProfileView (generics .RetrieveUpdateAPIView ):
48+ """
49+ An endpoint for users to view and update their profile information.
50+ """
4551
4652 serializer_class = serializers .UserProfileSerializer
4753
You can’t perform that action at this time.
0 commit comments