mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Move exclusion check to should_include_endpoint
This commit is contained in:
parent
8e3844c246
commit
6b8bbe8e1f
|
@ -148,6 +148,9 @@ class EndpointEnumerator(object):
|
||||||
if not is_api_view(callback):
|
if not is_api_view(callback):
|
||||||
return False # Ignore anything except REST framework views.
|
return False # Ignore anything except REST framework views.
|
||||||
|
|
||||||
|
if getattr(callback.cls, 'exclude_from_schema', False):
|
||||||
|
return False
|
||||||
|
|
||||||
if path.endswith('.{format}') or path.endswith('.{format}/'):
|
if path.endswith('.{format}') or path.endswith('.{format}/'):
|
||||||
return False # Ignore .json style URLs.
|
return False # Ignore .json style URLs.
|
||||||
|
|
||||||
|
@ -239,8 +242,6 @@ class SchemaGenerator(object):
|
||||||
view_endpoints = []
|
view_endpoints = []
|
||||||
for path, method, callback in self.endpoints:
|
for path, method, callback in self.endpoints:
|
||||||
view = self.create_view(callback, method, request)
|
view = self.create_view(callback, method, request)
|
||||||
if getattr(view, 'exclude_from_schema', False):
|
|
||||||
continue
|
|
||||||
path = self.coerce_path(path, method, view)
|
path = self.coerce_path(path, method, view)
|
||||||
paths.append(path)
|
paths.append(path)
|
||||||
view_endpoints.append((path, method, view))
|
view_endpoints.append((path, method, view))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user