From aa10958627a8b214275f66fd0f3818215ff16483 Mon Sep 17 00:00:00 2001 From: Tommy Beadle Date: Tue, 4 Apr 2017 14:35:05 -0400 Subject: [PATCH] Include @detail_routes and @list_routes in the auto generated docs. --- .../rest_framework/docs/document-incl.html | 17 +++++++++++++++++ .../rest_framework/docs/document.html | 17 +++-------------- .../rest_framework/docs/sidebar-menu.html | 18 ++++++++++++++++++ .../templates/rest_framework/docs/sidebar.html | 14 +++----------- 4 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 rest_framework/templates/rest_framework/docs/document-incl.html create mode 100644 rest_framework/templates/rest_framework/docs/sidebar-menu.html diff --git a/rest_framework/templates/rest_framework/docs/document-incl.html b/rest_framework/templates/rest_framework/docs/document-incl.html new file mode 100644 index 000000000..bb2020364 --- /dev/null +++ b/rest_framework/templates/rest_framework/docs/document-incl.html @@ -0,0 +1,17 @@ +{% load rest_framework %} + +{% for link_key, link in section.links|items %} + {% with section_key=parent_key %} + {% include "rest_framework/docs/link.html" %} + {% endwith %} +{% endfor %} + +{% for section_key, sect in section.data|items %} + {% if section_key %} +

{{ parent_key|add:' / ' }}{{ section_key }}

+ {% endif %} + + {% with parent_key=parent_key|add:'-'|add:section_key section=sect %} + {% include "rest_framework/docs/document-incl.html" %} + {% endwith %} +{% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/document.html b/rest_framework/templates/rest_framework/docs/document.html index ef5f5966b..16a487d71 100644 --- a/rest_framework/templates/rest_framework/docs/document.html +++ b/rest_framework/templates/rest_framework/docs/document.html @@ -14,17 +14,6 @@ -{% for section_key, section in document.data|items %} -{% if section_key %} -

{{ section_key }} -

-{% endif %} - - {% for link_key, link in section.links|items %} - {% include "rest_framework/docs/link.html" %} - {% endfor %} -{% endfor %} - -{% for link_key, link in document.links|items %} - {% include "rest_framework/docs/link.html" %} -{% endfor %} +{% with parent_key=None section=document %} + {% include "rest_framework/docs/document-incl.html" %} +{% endwith %} diff --git a/rest_framework/templates/rest_framework/docs/sidebar-menu.html b/rest_framework/templates/rest_framework/docs/sidebar-menu.html new file mode 100644 index 000000000..f4d92705c --- /dev/null +++ b/rest_framework/templates/rest_framework/docs/sidebar-menu.html @@ -0,0 +1,18 @@ +{% load rest_framework %} + +{% if section.links %} + +{% endif %} + +{% for key, sect in section.data|items %} + + {% with section=sect parent_key=parent_key|add:'-'|add:key %} + {% include 'rest_framework/docs/sidebar-menu.html' %} + {% endwith %} +{% endfor %} diff --git a/rest_framework/templates/rest_framework/docs/sidebar.html b/rest_framework/templates/rest_framework/docs/sidebar.html index c6ac26f66..3643983dd 100644 --- a/rest_framework/templates/rest_framework/docs/sidebar.html +++ b/rest_framework/templates/rest_framework/docs/sidebar.html @@ -1,20 +1,12 @@ -{% load rest_framework %}