diff options
Diffstat (limited to 'rest_framework/templates')
| -rw-r--r-- | rest_framework/templates/rest_framework/base.html | 9 | ||||
| -rw-r--r-- | rest_framework/templates/rest_framework/form.html | 12 | ||||
| -rw-r--r-- | rest_framework/templates/rest_framework/raw_data_form.html | 12 | 
3 files changed, 23 insertions, 10 deletions
diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html index 47377d51..42ede968 100644 --- a/rest_framework/templates/rest_framework/base.html +++ b/rest_framework/templates/rest_framework/base.html @@ -111,7 +111,9 @@          <div class="content-main">              <div class="page-header"><h1>{{ name }}</h1></div> +            {% block description %}              {{ description }} +            {% endblock %}              <div class="request-info" style="clear: both" >                  <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>              </div> @@ -152,7 +154,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> @@ -189,7 +191,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> @@ -220,9 +222,6 @@      </div><!-- ./wrapper -->      {% block footer %} -    <!--<div id="footer"> -        <a class="powered-by" href='http://django-rest-framework.org'>Django REST framework</a> -    </div>-->      {% endblock %}      {% block script %} diff --git a/rest_framework/templates/rest_framework/form.html b/rest_framework/templates/rest_framework/form.html index b27f652e..b1e148df 100644 --- a/rest_framework/templates/rest_framework/form.html +++ b/rest_framework/templates/rest_framework/form.html @@ -1,13 +1,15 @@  {% load rest_framework %}  {% csrf_token %}  {{ form.non_field_errors }} -{% for field in form %} -    <div class="control-group"> <!--{% if field.errors %}error{% endif %}--> +{% for field in form.fields.values %} +    {% if not field.read_only %} +    <div class="control-group {% if field.errors %}error{% endif %}">          {{ field.label_tag|add_class:"control-label" }}          <div class="controls"> -            {{ field }} -            <span class="help-block">{{ field.help_text }}</span> -            <!--{{ field.errors|add_class:"help-block" }}--> +            {{ field.widget_html }} +            {% if field.help_text %}<span class="help-block">{{ field.help_text }}</span>{% endif %} +            {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}          </div>      </div> +    {% endif %}  {% endfor %} 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 %}  | 
