Commit 64e801e4 by Roman Vasilyev Committed by Tom Christie

get view for django 'virtual hosts' (#4776)

Brill, thanks! 馃憤
parent a5fcf10c
......@@ -145,6 +145,18 @@ May be used to pass a canonical URL for the schema.
url='https://www.example.org/api/'
)
#### `urlconf`
A string representing the import path to the URL conf that you want
to generate an API schema for. This defaults to the value of Django's
ROOT_URLCONF setting.
schema_view = get_schema_view(
title='Server Monitoring API',
url='https://www.example.org/api/',
urlconf='myproject.urls'
)
#### `renderer_classes`
May be used to pass the set of renderer classes that can be used to render the API root endpoint.
......
......@@ -571,11 +571,11 @@ class SchemaGenerator(object):
return named_path_components + [action]
def get_schema_view(title=None, url=None, renderer_classes=None):
def get_schema_view(title=None, url=None, urlconf=None, renderer_classes=None):
"""
Return a schema view.
"""
generator = SchemaGenerator(title=title, url=url)
generator = SchemaGenerator(title=title, url=url, urlconf=urlconf)
if renderer_classes is None:
if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES:
rclasses = [renderers.CoreJSONRenderer, renderers.BrowsableAPIRenderer]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment