iter over items in python, not template

This commit is contained in:
tim watts 2017-03-01 19:14:29 +00:00
parent 95380f7717
commit 41ce298067
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{% load rest_framework %}
<table class="table table-striped">
<tbody>
{% for key, value in value.items %}
{% for key, value in value %}
<tr>
<th>{{ key|format_value }}</th>
<td>{{ value|format_value }}</td>

View File

@ -148,7 +148,7 @@ def format_value(value):
return template_render(template, context)
elif isinstance(value, dict):
template = loader.get_template('rest_framework/admin/dict_value.html')
context = {'value': value}
context = {'value': value.items()}
return template_render(template, context)
elif isinstance(value, six.string_types):
if (