aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/templates
diff options
context:
space:
mode:
authorTom Christie2011-05-27 14:40:19 +0100
committerTom Christie2011-05-27 14:40:19 +0100
commit21d2dcc2942a8e4adb3a79b0983841e5f0ab5878 (patch)
tree82acf04d4f092a392e6db51a7467c63406929a3c /djangorestframework/templates
parent9e9ae6094943d663a677b3bbe8e8af6a43744daf (diff)
downloaddjango-rest-framework-21d2dcc2942a8e4adb3a79b0983841e5f0ab5878.tar.bz2
Allow .form specified on view. Allow get_form, put_form, post_form. Add .PARAMS.
Diffstat (limited to 'djangorestframework/templates')
-rw-r--r--djangorestframework/templates/renderer.html22
1 files changed, 10 insertions, 12 deletions
diff --git a/djangorestframework/templates/renderer.html b/djangorestframework/templates/renderer.html
index 3010d712..09b17df7 100644
--- a/djangorestframework/templates/renderer.html
+++ b/djangorestframework/templates/renderer.html
@@ -58,19 +58,16 @@
</form>
{% endif %}
- {% comment %} *** Only display the POST/PUT/DELETE forms if we have a bound form, and if method ***
- *** tunneling via POST forms is enabled. ***
- *** (We could display only the POST form if method tunneling is disabled, but I think ***
- *** the user experience would be confusing, so we simply turn all forms off. *** {% endcomment %}
-
- {% if METHOD_PARAM and form %}
+ {# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled. #}
+ {% if METHOD_PARAM %}
+
{% if 'POST' in view.allowed_methods %}
- <form action="{{ request.path }}" method="post" {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
+ <form action="{{ request.path }}" method="post" {% if post_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
<fieldset class='module aligned'>
<h2>POST {{ name }}</h2>
{% csrf_token %}
- {{ form.non_field_errors }}
- {% for field in form %}
+ {{ post_form.non_field_errors }}
+ {% for field in post_form %}
<div class='form-row'>
{{ field.label_tag }}
{{ field }}
@@ -86,13 +83,13 @@
{% endif %}
{% if 'PUT' in view.allowed_methods %}
- <form action="{{ request.path }}" method="post" {% if form.is_multipart %}enctype="multipart/form-data"{% endif %}>
+ <form action="{{ request.path }}" method="post" {% if put_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
<fieldset class='module aligned'>
<h2>PUT {{ name }}</h2>
<input type="hidden" name="{{ METHOD_PARAM }}" value="PUT" />
{% csrf_token %}
- {{ form.non_field_errors }}
- {% for field in form %}
+ {{ put_form.non_field_errors }}
+ {% for field in put_form %}
<div class='form-row'>
{{ field.label_tag }}
{{ field }}
@@ -119,6 +116,7 @@
</fieldset>
</form>
{% endif %}
+
{% endif %}
</div>
</div>