mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Function based views get proper naming in browseable API
This commit is contained in:
parent
65f592866c
commit
beea6487b2
|
@ -21,6 +21,8 @@ def api_view(http_method_names):
|
|||
for method in http_method_names:
|
||||
setattr(WrappedAPIView, method.lower(), handler)
|
||||
|
||||
WrappedAPIView.__name__ = func.__name__
|
||||
|
||||
WrappedAPIView.renderer_classes = getattr(func, 'renderer_classes',
|
||||
APIView.renderer_classes)
|
||||
|
||||
|
|
|
@ -50,7 +50,8 @@ def _camelcase_to_spaces(content):
|
|||
Used when generating names from view classes.
|
||||
"""
|
||||
camelcase_boundry = '(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
|
||||
return re.sub(camelcase_boundry, ' \\1', content).strip()
|
||||
content = re.sub(camelcase_boundry, ' \\1', content).strip()
|
||||
return ' '.join(content.split('_')).title()
|
||||
|
||||
|
||||
class APIView(View):
|
||||
|
|
Loading…
Reference in New Issue
Block a user