diff options
| author | Tom Christie | 2013-10-02 16:13:34 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-10-02 16:13:34 +0100 |
| commit | 8d4ba478cc5725b4de6ab86b4825b1ea94cb4c7b (patch) | |
| tree | 75187b1e1d5bd77dd4f137b467da5ce7a5b09603 /rest_framework/templates | |
| parent | a14f1e886402b8d0f742fdbb912b03a4004e1735 (diff) | |
| download | django-rest-framework-8d4ba478cc5725b4de6ab86b4825b1ea94cb4c7b.tar.bz2 | |
Fix rendering of forms and add error rendering on HTML form
Diffstat (limited to 'rest_framework/templates')
| -rw-r--r-- | rest_framework/templates/rest_framework/base.html | 4 | ||||
| -rw-r--r-- | rest_framework/templates/rest_framework/raw_data_form.html | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 2776d550..33be36db 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -151,7 +151,7 @@ {% with form=raw_data_post_form %} <form action="{{ request.get_full_path }}" method="POST" class="form-horizontal"> <fieldset> - {% include "rest_framework/form.html" %} + {% include "rest_framework/raw_data_form.html" %} <div class="form-actions"> <button class="btn btn-primary" title="Make a POST request on the {{ name }} resource">POST</button> </div> @@ -188,7 +188,7 @@ {% with form=raw_data_put_or_patch_form %} <form action="{{ request.get_full_path }}" method="POST" class="form-horizontal"> <fieldset> - {% include "rest_framework/form.html" %} + {% include "rest_framework/raw_data_form.html" %} <div class="form-actions"> {% if raw_data_put_form %} <button class="btn btn-primary js-tooltip" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="PUT" title="Make a PUT request on the {{ name }} resource">PUT</button> diff --git a/rest_framework/templates/rest_framework/raw_data_form.html b/rest_framework/templates/rest_framework/raw_data_form.html new file mode 100644 index 00000000..075279f7 --- /dev/null +++ b/rest_framework/templates/rest_framework/raw_data_form.html @@ -0,0 +1,12 @@ +{% load rest_framework %} +{% csrf_token %} +{{ form.non_field_errors }} +{% for field in form %} + <div class="control-group"> + {{ field.label_tag|add_class:"control-label" }} + <div class="controls"> + {{ field }} + <span class="help-block">{{ field.help_text }}</span> + </div> + </div> +{% endfor %} |
