aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/templates
diff options
context:
space:
mode:
authorTom Christie2014-10-09 15:11:19 +0100
committerTom Christie2014-10-09 15:11:19 +0100
commit5d247a65c89594a7ab5ce2333612f23eadc6828d (patch)
treed9e67e3a84a588747cd6e39356151149cf73b376 /rest_framework/templates
parentbabdc78e61ac915fa4a01bdfb04e11a32dbf5d79 (diff)
downloaddjango-rest-framework-5d247a65c89594a7ab5ce2333612f23eadc6828d.tar.bz2
First pass on nested serializers in HTML
Diffstat (limited to 'rest_framework/templates')
-rw-r--r--rest_framework/templates/rest_framework/fields/horizontal/fieldset.html5
-rw-r--r--rest_framework/templates/rest_framework/fields/horizontal/list_fieldset.html13
-rw-r--r--rest_framework/templates/rest_framework/fields/inline/fieldset.html5
-rw-r--r--rest_framework/templates/rest_framework/fields/vertical/fieldset.html5
-rw-r--r--rest_framework/templates/rest_framework/fields/vertical/list_fieldset.html7
5 files changed, 29 insertions, 6 deletions
diff --git a/rest_framework/templates/rest_framework/fields/horizontal/fieldset.html b/rest_framework/templates/rest_framework/fields/horizontal/fieldset.html
index 843a56b2..ff93c6ba 100644
--- a/rest_framework/templates/rest_framework/fields/horizontal/fieldset.html
+++ b/rest_framework/templates/rest_framework/fields/horizontal/fieldset.html
@@ -1,10 +1,11 @@
+{% load rest_framework %}
<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>
</div>
{% endif %}
- {% for field_item in field.value.field_items.values() %}
- {{ renderer.render_field(field_item, layout=layout) }}
+ {% for nested_field in field %}
+ {% render_field nested_field layout=layout renderer=renderer %}
{% endfor %}
</fieldset>
diff --git a/rest_framework/templates/rest_framework/fields/horizontal/list_fieldset.html b/rest_framework/templates/rest_framework/fields/horizontal/list_fieldset.html
new file mode 100644
index 00000000..68c75d4f
--- /dev/null
+++ b/rest_framework/templates/rest_framework/fields/horizontal/list_fieldset.html
@@ -0,0 +1,13 @@
+{% load rest_framework %}
+<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>
+ </div>
+ {% endif %}
+ <ul>
+ {% for child in field.value %}
+ <li>TODO</li>
+ {% endfor %}
+ </ul>
+</fieldset>
diff --git a/rest_framework/templates/rest_framework/fields/inline/fieldset.html b/rest_framework/templates/rest_framework/fields/inline/fieldset.html
index 380d4627..ba9f1835 100644
--- a/rest_framework/templates/rest_framework/fields/inline/fieldset.html
+++ b/rest_framework/templates/rest_framework/fields/inline/fieldset.html
@@ -1,3 +1,4 @@
-{% for field_item in field.value.field_items.values() %}
- {{ renderer.render_field(field_item, layout=layout) }}
+{% load rest_framework %}
+{% for nested_field in field %}
+ {% render_field nested_field layout=layout renderer=renderer %}
{% endfor %}
diff --git a/rest_framework/templates/rest_framework/fields/vertical/fieldset.html b/rest_framework/templates/rest_framework/fields/vertical/fieldset.html
index 8708916b..248fe904 100644
--- a/rest_framework/templates/rest_framework/fields/vertical/fieldset.html
+++ b/rest_framework/templates/rest_framework/fields/vertical/fieldset.html
@@ -1,6 +1,7 @@
+{% load rest_framework %}
<fieldset>
{% if field.label %}<legend {% if field.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) }}
+ {% for nested_field in field %}
+ {% render_field nested_field layout=layout renderer=renderer %}
{% endfor %}
</fieldset>
diff --git a/rest_framework/templates/rest_framework/fields/vertical/list_fieldset.html b/rest_framework/templates/rest_framework/fields/vertical/list_fieldset.html
new file mode 100644
index 00000000..6b99a834
--- /dev/null
+++ b/rest_framework/templates/rest_framework/fields/vertical/list_fieldset.html
@@ -0,0 +1,7 @@
+<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 %}
+ {% for field_item in field.value.field_items.values() %}
+ {{ renderer.render_field(field_item, layout=layout) }}
+ {% endfor %} -->
+</fieldset>