Skip to content

Commit f33aa98

Browse files
Fix case when RegexURLPattern has no parent
1 parent 4470670 commit f33aa98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rest_framework_docs/api_docs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def get_all_view_names(self, urlpatterns, parent_api_node=None):
5252
)
5353
self.get_all_view_names(urlpatterns=pattern.url_patterns, parent_api_node=parent)
5454
elif isinstance(pattern, RegexURLPattern) and _is_drf_view(pattern) and not _is_format_endpoint(pattern):
55-
router = parent_api_node.drf_router
56-
router = self.drf_router if router is None else router
55+
router = self.drf_router
56+
if parent_api_node is not None:
57+
if parent_api_node.drf_router is not None:
58+
router = parent_api_node.drf_router
5759
api_endpoint = ApiEndpoint(pattern, parent_api_node, router)
5860
self.endpoints.append(api_endpoint)
5961

0 commit comments

Comments
 (0)