mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Merge a223f4d3d7
into 5ea810d526
This commit is contained in:
commit
6028f1e0c8
|
@ -454,7 +454,10 @@ class SchemaGenerator(object):
|
|||
if self.url and path.startswith('/'):
|
||||
path = path[1:]
|
||||
|
||||
title = self.get_title(view)
|
||||
|
||||
return coreapi.Link(
|
||||
title=title,
|
||||
url=urlparse.urljoin(self.url, path),
|
||||
action=method.lower(),
|
||||
encoding=encoding,
|
||||
|
@ -462,6 +465,14 @@ class SchemaGenerator(object):
|
|||
description=description
|
||||
)
|
||||
|
||||
def get_title(self, view):
|
||||
"""
|
||||
Determine a title from a view instance.
|
||||
|
||||
If the 'title' attribute is not set on the view, then an empty title is returned.
|
||||
"""
|
||||
return getattr(view, 'title', '')
|
||||
|
||||
def get_description(self, path, method, view):
|
||||
"""
|
||||
Determine a link description.
|
||||
|
|
Loading…
Reference in New Issue
Block a user