mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
add better example in comments
This commit is contained in:
parent
cc2a8a5a35
commit
8d3051d3a3
|
@ -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:]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user