From c33e762c2a527edf076c3c942e0179c4279e015e Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Tue, 27 Nov 2018 17:39:44 +0000 Subject: [PATCH 1/2] Add blocks for 'request_forms', 'main_content' and 'edit_forms' to make the template easier to extend --- rest_framework/templates/rest_framework/base.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 5b489ee1ae..20127edb51 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -76,6 +76,7 @@ {% block content %}
+ {% block request_forms %} {% if 'GET' in allowed_methods %}
@@ -148,9 +149,11 @@

Are you sure you want to delete this {{ name }}?

{% trans "Filters" %} {% endif %} + {% endblock request_forms %}
+ {% block main_content %} @@ -176,8 +179,10 @@

{{ name }}

{{ content|urlize_quoted_links }}{% endautoescape %}
+ {% endblock %} + {% block edit_forms %} {% if display_edit_forms %} {% if post_form or raw_data_post_form %}
@@ -273,6 +278,7 @@

{{ name }}

{% endif %} {% endif %} + {% endblock edit_forms %} {% endblock content %} From 8a42188ebaa5c7cf8481228d5f16ce6cb8160fea Mon Sep 17 00:00:00 2001 From: Andy Babic Date: Tue, 27 Nov 2018 17:45:28 +0000 Subject: [PATCH 2/2] Fix indentation --- .../templates/rest_framework/base.html | 324 +++++++++--------- 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 20127edb51..07bfdcbca1 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -76,135 +76,149 @@ {% block content %}
- {% block request_forms %} - {% if 'GET' in allowed_methods %} - -
- {% if api_settings.URL_FORMAT_OVERRIDE %} -
- GET + {% block request_forms %} + {% if 'GET' in allowed_methods %} + +
+ {% if api_settings.URL_FORMAT_OVERRIDE %} +
+ GET - - -
- {% else %} - GET - {% endif %} -
- - {% endif %} + + +
+ {% else %} + GET + {% endif %} +
+ + {% endif %} - {% if options_form %} -
- -
- {% endif %} + {% if options_form %} +
+ +
+ {% endif %} - {% if delete_form %} - + {% if delete_form %} + - -