Skip to content

Commit 969a0f3

Browse files
author
Emmanouil Konstantinidis
committed
Group endpoints by parent app (namespace)
1 parent e2355b6 commit 969a0f3

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

drfdocs/templates/drfdocs/home.html

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,37 @@
22

33
{% block content %}
44

5-
<h2>API Endpoints</h2>
5+
<h1>API Endpoints</h1>
6+
{% regroup endpoints by name_parent as endpoints_grouped %}
67

7-
{% for endpoint in endpoints %}
8-
{{endpoint.name_parent}}
8+
{% for group in endpoints_grouped %}
9+
<h1>{{group.grouper}}</h1>
910

10-
<div class="endpoint">
11-
<h4 class="title">{{ endpoint.path }}</h4>
11+
{% for endpoint in group.list %}
12+
<div class="endpoint">
13+
<h4 class="title">{{ endpoint.path }}</h4>
1214

13-
<ul class="list-inline methods">
14-
{% for method in endpoint.allowed_methods %}
15-
<li class="method">{{ method }}</li>
16-
{% endfor %}
17-
</ul>
15+
<ul class="list-inline methods">
16+
{% for method in endpoint.allowed_methods %}
17+
<li class="method">{{ method }}</li>
18+
{% endfor %}
19+
</ul>
1820

19-
<p>View Name: {{ endpoint.view_name }}</p>
20-
<p>URL Name: {{ endpoint.name }}</p>
21+
<p>View Name: {{ endpoint.view_name }}</p>
22+
<p>URL Name: {{ endpoint.name }}</p>
2123

22-
{% if endpoint.fields %}
23-
<p>Fields:</p>
24-
<ul class="list fields">
25-
{% for field in endpoint.fields %}
26-
<li class="field">{{ field.name }}: {{ field.type }}</li>
27-
{% endfor %}
28-
</ul>
29-
{% endif %}
24+
{% if endpoint.fields %}
25+
<p>Fields:</p>
26+
<ul class="list fields">
27+
{% for field in endpoint.fields %}
28+
<li class="field">{{ field.name }}: {{ field.type }}</li>
29+
{% endfor %}
30+
</ul>
31+
{% endif %}
32+
33+
</div>
34+
{% endfor %}
3035

31-
</div>
3236
{% endfor %}
3337

3438
{% endblock %}

0 commit comments

Comments
 (0)