Skip to content

Commit e2355b6

Browse files
author
Emmanouil Konstantinidis
committed
Separate Parent App Name
1 parent 04b50df commit e2355b6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

drfdocs/api_endpoint.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ def __init__(self, pattern, parent_pattern=None):
77
self.pattern = pattern
88
self.callback = pattern.callback
99
self.name = pattern.name
10+
self.name_parent = simplify_regex(parent_pattern.regex.pattern).replace('/', '') if parent_pattern else None
1011
self.path = self.__get_path__(parent_pattern)
1112
self.allowed_methods = self.__get_allowed_methods__()
1213
self.view_name = pattern.callback.__name__
1314
self.fields = self.__get_serializer_fields__()
1415

1516
def __get_path__(self, parent_pattern):
1617
if parent_pattern:
17-
parent_path = simplify_regex(parent_pattern.regex.pattern)[:-1]
18-
return "{0}{1}".format(parent_path, simplify_regex(self.pattern.regex.pattern))
18+
return "/{0}{1}".format(self.name_parent, simplify_regex(self.pattern.regex.pattern))
1919
return simplify_regex(self.pattern.regex.pattern)
2020

2121
def __get_allowed_methods__(self):

drfdocs/templates/drfdocs/home.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
<h2>API Endpoints</h2>
66

77
{% for endpoint in endpoints %}
8+
{{endpoint.name_parent}}
9+
810
<div class="endpoint">
9-
<h3 class="title">{{ endpoint.path }}</h3>
11+
<h4 class="title">{{ endpoint.path }}</h4>
1012

1113
<ul class="list-inline methods">
1214
{% for method in endpoint.allowed_methods %}

0 commit comments

Comments
 (0)