aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/templates
diff options
context:
space:
mode:
authorTom Christie2014-10-15 13:35:12 +0100
committerTom Christie2014-10-15 13:35:12 +0100
commit36fbc7678c3437dfe2d70380ab1b153429641bb5 (patch)
tree63bcdd9448b1cd166708538388a108949af75742 /rest_framework/templates
parentcc1c4232554153ac6a24b6b4f89ecaac80b28bfd (diff)
downloaddjango-rest-framework-36fbc7678c3437dfe2d70380ab1b153429641bb5.tar.bz2
Moar form styling
Diffstat (limited to 'rest_framework/templates')
-rw-r--r--rest_framework/templates/rest_framework/base.html2
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/checkbox.html8
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/checkbox_multiple.html (renamed from rest_framework/templates/rest_framework/horizontal/fields/select_checkbox.html)10
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/fieldset.html4
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/input.html13
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/list_fieldset.html2
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/radio.html (renamed from rest_framework/templates/rest_framework/horizontal/fields/select_radio.html)10
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/select.html8
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/select_multiple.html8
-rw-r--r--rest_framework/templates/rest_framework/horizontal/fields/textarea.html13
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/checkbox.html12
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/checkbox_multiple.html (renamed from rest_framework/templates/rest_framework/inline/fields/select_checkbox.html)2
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/fieldset.html2
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/input.html4
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/radio.html (renamed from rest_framework/templates/rest_framework/inline/fields/select_radio.html)2
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/select.html2
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/select_multiple.html2
-rw-r--r--rest_framework/templates/rest_framework/inline/fields/textarea.html4
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/checkbox.html20
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/checkbox_multiple.html (renamed from rest_framework/templates/rest_framework/vertical/fields/select_checkbox.html)12
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/fieldset.html4
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/input.html13
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/list_fieldset.html4
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/radio.html (renamed from rest_framework/templates/rest_framework/vertical/fields/select_radio.html)12
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/select.html10
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/select_multiple.html10
-rw-r--r--rest_framework/templates/rest_framework/vertical/fields/textarea.html13
27 files changed, 145 insertions, 61 deletions
diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html
index 2e03dd98..4b6c7fcf 100644
--- a/rest_framework/templates/rest_framework/base.html
+++ b/rest_framework/templates/rest_framework/base.html
@@ -59,7 +59,7 @@
<ul class="breadcrumb">
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
{% if forloop.last %}
- <li class="active">{{ breadcrumb_name }}</li>
+ <li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% else %}
<li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
{% endif %}
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/checkbox.html b/rest_framework/templates/rest_framework/horizontal/fields/checkbox.html
index ee3bf936..07a7308f 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/checkbox.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/checkbox.html
@@ -1,4 +1,4 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
@@ -6,5 +6,11 @@
{% if field.label %}{{ field.label }}{% endif %}
</label>
</div>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/select_checkbox.html b/rest_framework/templates/rest_framework/horizontal/fields/checkbox_multiple.html
index ff3fab57..ec7d5935 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/select_checkbox.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/checkbox_multiple.html
@@ -1,9 +1,9 @@
<div class="form-group">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
- {% if field.style.inline %}
+ {% if style.inline %}
{% for key, text in field.choices.items %}
<label class="checkbox-inline">
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key in field.value %}checked{% endif %}>
@@ -20,5 +20,11 @@
</div>
{% endfor %}
{% endif %}
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/fieldset.html b/rest_framework/templates/rest_framework/horizontal/fields/fieldset.html
index ff93c6ba..f6d5dd9d 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/fieldset.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/fieldset.html
@@ -2,10 +2,10 @@
<fieldset>
{% if field.label %}
<div class="form-group" style="border-bottom: 1px solid #e5e5e5">
- <legend class="control-label col-sm-2 {% if field.style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend>
+ <legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend>
</div>
{% endif %}
{% for nested_field in field %}
- {% render_field nested_field layout=layout renderer=renderer %}
+ {% render_field nested_field template_pack=template_pack renderer=renderer %}
{% endfor %}
</fieldset>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/input.html b/rest_framework/templates/rest_framework/horizontal/fields/input.html
index 6621c7e6..43ab4151 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/input.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/input.html
@@ -1,9 +1,14 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
- <input name="{{ field.name }}" type="{{ input_type }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
- {% if field.help_text %}<p class="help-block">{{ field.help_text }}</p>{% endif %}
+ <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/list_fieldset.html b/rest_framework/templates/rest_framework/horizontal/fields/list_fieldset.html
index 68c75d4f..a30514c6 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/list_fieldset.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/list_fieldset.html
@@ -2,7 +2,7 @@
<fieldset>
{% if field.label %}
<div class="form-group" style="border-bottom: 1px solid #e5e5e5">
- <legend class="control-label col-sm-2 {% if field.style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend>
+ <legend class="control-label col-sm-2 {% if style.hide_label %}sr-only{% endif %}" style="border-bottom: 0">{{ field.label }}</legend>
</div>
{% endif %}
<ul>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/select_radio.html b/rest_framework/templates/rest_framework/horizontal/fields/radio.html
index 6e56afb5..52238bb1 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/select_radio.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/radio.html
@@ -1,9 +1,9 @@
<div class="form-group">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
- {% if field.style.inline %}
+ {% if style.inline %}
{% for key, text in field.choices.items %}
<label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}>
@@ -20,5 +20,11 @@
</div>
{% endfor %}
{% endif %}
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/select.html b/rest_framework/templates/rest_framework/horizontal/fields/select.html
index eaa6d575..1d00f424 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/select.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/select.html
@@ -1,6 +1,6 @@
<div class="form-group">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
<select class="form-control" name="{{ field.name }}">
@@ -8,5 +8,11 @@
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/select_multiple.html b/rest_framework/templates/rest_framework/horizontal/fields/select_multiple.html
index 3ed2874b..01c251fb 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/select_multiple.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/select_multiple.html
@@ -1,6 +1,6 @@
<div class="form-group">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
<select multiple class="form-control" name="{{ field.name }}">
@@ -8,5 +8,11 @@
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/horizontal/fields/textarea.html b/rest_framework/templates/rest_framework/horizontal/fields/textarea.html
index ae263c48..ec107549 100644
--- a/rest_framework/templates/rest_framework/horizontal/fields/textarea.html
+++ b/rest_framework/templates/rest_framework/horizontal/fields/textarea.html
@@ -1,9 +1,14 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label class="col-sm-2 control-label {% if field.style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
+ <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>
{% endif %}
<div class="col-sm-10">
- <textarea name="{{ field.name }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.style.rows %}rows="{{ field.style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
- {% if field.help_text %}<p class="help-block">{{ field.help_text }}</p>{% endif %}
+ <textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
</div>
diff --git a/rest_framework/templates/rest_framework/inline/fields/checkbox.html b/rest_framework/templates/rest_framework/inline/fields/checkbox.html
index 57fa5dc0..71737f15 100644
--- a/rest_framework/templates/rest_framework/inline/fields/checkbox.html
+++ b/rest_framework/templates/rest_framework/inline/fields/checkbox.html
@@ -1,6 +1,8 @@
-<div class="checkbox">
- <label>
- <input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
- {% if field.label %}{{ field.label }}{% endif %}
- </label>
+<div class="form-group {% if field.errors %}has-error{% endif %}">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="{{ field.name }}" value="true" {% if field.value %}checked{% endif %}>
+ {% if field.label %}{{ field.label }}{% endif %}
+ </label>
+ </div>
</div>
diff --git a/rest_framework/templates/rest_framework/inline/fields/select_checkbox.html b/rest_framework/templates/rest_framework/inline/fields/checkbox_multiple.html
index cca71d68..6caf6440 100644
--- a/rest_framework/templates/rest_framework/inline/fields/select_checkbox.html
+++ b/rest_framework/templates/rest_framework/inline/fields/checkbox_multiple.html
@@ -1,4 +1,4 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
diff --git a/rest_framework/templates/rest_framework/inline/fields/fieldset.html b/rest_framework/templates/rest_framework/inline/fields/fieldset.html
index ba9f1835..5ee182a5 100644
--- a/rest_framework/templates/rest_framework/inline/fields/fieldset.html
+++ b/rest_framework/templates/rest_framework/inline/fields/fieldset.html
@@ -1,4 +1,4 @@
{% load rest_framework %}
{% for nested_field in field %}
- {% render_field nested_field layout=layout renderer=renderer %}
+ {% render_field nested_field template_pack=template_pack renderer=renderer %}
{% endfor %}
diff --git a/rest_framework/templates/rest_framework/inline/fields/input.html b/rest_framework/templates/rest_framework/inline/fields/input.html
index bdf25ffe..0d3eb884 100644
--- a/rest_framework/templates/rest_framework/inline/fields/input.html
+++ b/rest_framework/templates/rest_framework/inline/fields/input.html
@@ -1,6 +1,6 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
- <input name="{{ field.name }}" type="{{ input_type }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
+ <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
</div>
diff --git a/rest_framework/templates/rest_framework/inline/fields/select_radio.html b/rest_framework/templates/rest_framework/inline/fields/radio.html
index 3fffceac..1915f4f8 100644
--- a/rest_framework/templates/rest_framework/inline/fields/select_radio.html
+++ b/rest_framework/templates/rest_framework/inline/fields/radio.html
@@ -1,4 +1,4 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
diff --git a/rest_framework/templates/rest_framework/inline/fields/select.html b/rest_framework/templates/rest_framework/inline/fields/select.html
index 730fcce6..e9fcebb4 100644
--- a/rest_framework/templates/rest_framework/inline/fields/select.html
+++ b/rest_framework/templates/rest_framework/inline/fields/select.html
@@ -1,4 +1,4 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
diff --git a/rest_framework/templates/rest_framework/inline/fields/select_multiple.html b/rest_framework/templates/rest_framework/inline/fields/select_multiple.html
index 3f9b2701..feddf7ab 100644
--- a/rest_framework/templates/rest_framework/inline/fields/select_multiple.html
+++ b/rest_framework/templates/rest_framework/inline/fields/select_multiple.html
@@ -1,4 +1,4 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
diff --git a/rest_framework/templates/rest_framework/inline/fields/textarea.html b/rest_framework/templates/rest_framework/inline/fields/textarea.html
index bdf25ffe..0766a01c 100644
--- a/rest_framework/templates/rest_framework/inline/fields/textarea.html
+++ b/rest_framework/templates/rest_framework/inline/fields/textarea.html
@@ -1,6 +1,6 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
<label class="sr-only">{{ field.label }}</label>
{% endif %}
- <input name="{{ field.name }}" type="{{ input_type }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
+ <input name="{{ field.name }}" type="text" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/checkbox.html b/rest_framework/templates/rest_framework/vertical/fields/checkbox.html
index 9fd4cdaa..e21a8e90 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/checkbox.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/checkbox.html
@@ -1,6 +1,14 @@
-<div class="checkbox">
- <label>
- <input type="checkbox" name="{{ field.name }}" value="true" {% if value %}checked{% endif %}>
- {% if field.label %}{{ field.label }}{% endif %}
- </label>
-</div>
+<div class="form-group {% if field.errors %}has-error{% endif %}">
+ <div class="checkbox">
+ <label>
+ <input type="checkbox" name="{{ field.name }}" value="true" {% if value %}checked{% endif %}>
+ {% if field.label %}{{ field.label }}{% endif %}
+ </label>
+ </div>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
+</div> \ No newline at end of file
diff --git a/rest_framework/templates/rest_framework/vertical/fields/select_checkbox.html b/rest_framework/templates/rest_framework/vertical/fields/checkbox_multiple.html
index c486b1b3..134cca66 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/select_checkbox.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/checkbox_multiple.html
@@ -1,8 +1,8 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %}
- {% if field.style.inline %}
+ {% if style.inline %}
<div>
{% for key, text in field.choices.items %}
<label class="checkbox-inline">
@@ -21,4 +21,10 @@
</div>
{% endfor %}
{% endif %}
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/fieldset.html b/rest_framework/templates/rest_framework/vertical/fields/fieldset.html
index 248fe904..824e6098 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/fieldset.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/fieldset.html
@@ -1,7 +1,7 @@
{% load rest_framework %}
<fieldset>
- {% if field.label %}<legend {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
+ {% if field.label %}<legend {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
{% for nested_field in field %}
- {% render_field nested_field layout=layout renderer=renderer %}
+ {% render_field nested_field template_pack=template_pack renderer=renderer %}
{% endfor %}
</fieldset>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/input.html b/rest_framework/templates/rest_framework/vertical/fields/input.html
index 10a576b2..4f4cb017 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/input.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/input.html
@@ -1,7 +1,12 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ {% endif %}
+ <input name="{{ field.name }}" class="form-control" type="{{ style.input_type }}" novalidate {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
{% endif %}
- <input name="{{ field.name }}" type="{{ input_type }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.style.rows %}rows="{{ field.style.rows }}"{% endif %} {% if field.value %}value="{{ field.value }}"{% endif %}>
- {% if field.help_text %}<p class="help-block">{{ field.help_text }}</p>{% endif %}
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/list_fieldset.html b/rest_framework/templates/rest_framework/vertical/fields/list_fieldset.html
index 6b99a834..74bbf448 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/list_fieldset.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/list_fieldset.html
@@ -1,6 +1,6 @@
<fieldset>
- {% if field.label %}<legend {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
-<!-- {% if field.label %}<legend {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
+ {% if field.label %}<legend {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
+<!-- {% if field.label %}<legend {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</legend>{% endif %}
{% for field_item in field.value.field_items.values() %}
{{ renderer.render_field(field_item, layout=layout) }}
{% endfor %} -->
diff --git a/rest_framework/templates/rest_framework/vertical/fields/select_radio.html b/rest_framework/templates/rest_framework/vertical/fields/radio.html
index d7655b00..ed9f9ddb 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/select_radio.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/radio.html
@@ -1,8 +1,8 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %}
- {% if field.style.inline %}
+ {% if style.inline %}
<div>
{% for key, text in field.choices.items %}
<label class="radio-inline">
@@ -21,4 +21,10 @@
</div>
{% endfor %}
{% endif %}
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/select.html b/rest_framework/templates/rest_framework/vertical/fields/select.html
index b0545f7e..7c673ebb 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/select.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/select.html
@@ -1,10 +1,16 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %}
<select class="form-control" name="{{ field.name }}">
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/select_multiple.html b/rest_framework/templates/rest_framework/vertical/fields/select_multiple.html
index ca63192e..54839294 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/select_multiple.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/select_multiple.html
@@ -1,10 +1,16 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
{% endif %}
<select multiple class="form-control" name="{{ field.name }}">
{% for key, text in field.choices.items %}
<option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option>
{% endfor %}
</select>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
+ {% endif %}
</div>
diff --git a/rest_framework/templates/rest_framework/vertical/fields/textarea.html b/rest_framework/templates/rest_framework/vertical/fields/textarea.html
index 8d951496..840ea853 100644
--- a/rest_framework/templates/rest_framework/vertical/fields/textarea.html
+++ b/rest_framework/templates/rest_framework/vertical/fields/textarea.html
@@ -1,7 +1,12 @@
-<div class="form-group">
+<div class="form-group {% if field.errors %}has-error{% endif %}">
{% if field.label %}
- <label {% if field.style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
+ {% endif %}
+ <textarea name="{{ field.name }}" class="form-control" {% if style.placeholder %}placeholder="{{ style.placeholder }}"{% endif %} {% if style.rows %}rows="{{ style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
+ {% if field.errors %}
+ {% for error in field.errors %}<span class="help-block">{{ error }}</span>{% endfor %}
+ {% endif %}
+ {% if field.help_text %}
+ <span class="help-block">{{ field.help_text }}</span>
{% endif %}
- <textarea name="{{ field.name }}" class="form-control" {% if field.style.placeholder %}placeholder="{{ field.style.placeholder }}"{% endif %} {% if field.style.rows %}rows="{{ field.style.rows }}"{% endif %}>{% if field.value %}{{ field.value }}{% endif %}</textarea>
- {% if field.help_text %}<p class="help-block">{{ field.help_text }}</p>{% endif %}
</div>