diff options
| author | Tom Christie | 2013-12-13 16:32:34 +0000 | 
|---|---|---|
| committer | Tom Christie | 2013-12-13 16:32:34 +0000 | 
| commit | 9c41c007afc71c899306bcb02e40bdfc36b09146 (patch) | |
| tree | ca0da04aed0c1b96ddf14a801dc54b5a72a72461 /rest_framework/templates | |
| parent | ed931b90ae9e72f963673e6e188b1802a5a65360 (diff) | |
| parent | ca244ad614e2f6fb4fef1dc9987be996d2624303 (diff) | |
| download | django-rest-framework-9c41c007afc71c899306bcb02e40bdfc36b09146.tar.bz2 | |
Merge branch 'master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/routers.md
	docs/topics/release-notes.md
	rest_framework/compat.py
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 %}  | 
