add better example in comments

This commit is contained in:
Dhaval Mehta 2020-02-19 22:12:36 +05:30
parent cc2a8a5a35
commit 8d3051d3a3

View File

@ -579,8 +579,9 @@ class AutoSchema(ViewInspector):
return self._tags return self._tags
# Extract tag from viewset name # Extract tag from viewset name
# UserView tags = [User] # UserProfileViewSet tags = [user-profile]
# User tags = [User] # UserProfileView tags = [user-profile]
# UserProfile tags = [user-profile]
if hasattr(self.view, 'action'): if hasattr(self.view, 'action'):
name = self.view.__class__.__name__ name = self.view.__class__.__name__
if name.endswith('ViewSet'): if name.endswith('ViewSet'):
@ -590,8 +591,8 @@ class AutoSchema(ViewInspector):
return [camelcase_to_spaces(name).lower().replace(' ', '-')] return [camelcase_to_spaces(name).lower().replace(' ', '-')]
# First element of a specific path could be valid tag. This is a fallback solution. # First element of a specific path could be valid tag. This is a fallback solution.
# PUT, PATCH, GET(Retrieve), DELETE: /users/{id}/ tags = [users] # PUT, PATCH, GET(Retrieve), DELETE: /user_profile/{id}/ tags = [user-profile]
# POST, GET(List): /users/ tags = [users] # POST, GET(List): /user_profile/ tags = [user-profile]
if path.startswith('/'): if path.startswith('/'):
path = path[1:] path = path[1:]