Use 'items' templatetag throughout.

This commit is contained in:
Tom Christie 2017-03-13 12:35:19 +00:00
parent df2adbb423
commit 0173e9bd21
9 changed files with 17 additions and 16 deletions

View File

@ -150,7 +150,7 @@
</div> </div>
<div class="response-info"> <div class="response-info">
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}{% for key, val in response_headers.items %} <pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}{% for key, val in response_headers|items %}
<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>{% endfor %} <b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>{% endfor %}
</span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %} </span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %}

View File

@ -14,17 +14,17 @@
</div> </div>
</div> </div>
{% for section_key, section in document.data.items %} {% for section_key, section in document.data|items %}
{% if section_key %} {% if section_key %}
<h2 id="{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i> <h2 id="{{ section_key }}" class="coredocs-section-title">{{ section_key }} <a href="#{{ section_key }}"><i class="fa fa-link" aria-hidden="true"></i>
</a></h2> </a></h2>
{% endif %} {% endif %}
{% for link_key, link in section.links.items %} {% for link_key, link in section.links|items %}
{% include "rest_framework/docs/link.html" %} {% include "rest_framework/docs/link.html" %}
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
{% for link_key, link in document.links.items %} {% for link_key, link in document.links|items %}
{% include "rest_framework/docs/link.html" %} {% include "rest_framework/docs/link.html" %}
{% endfor %} {% endfor %}

View File

@ -1,15 +1,16 @@
{% load rest_framework %}
<div class="sidebar"> <div class="sidebar">
<h3 class="brand"><a href="#">{{ document.title }}</a></h3> <h3 class="brand"><a href="#">{{ document.title }}</a></h3>
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i> <i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
<div class="menu-list"> <div class="menu-list">
<ul id="menu-content" class="menu-content collapse out"> <ul id="menu-content" class="menu-content collapse out">
{% for section_key, section in document.data.items %} {% for section_key, section in document.data|items %}
<li data-toggle="collapse" data-target="#{{ section_key }}-dropdown" class="collapsed"> <li data-toggle="collapse" data-target="#{{ section_key }}-dropdown" class="collapsed">
<a><i class="fa fa-dot-circle-o fa-lg"></i> {% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %} <span class="arrow"></span></a> <a><i class="fa fa-dot-circle-o fa-lg"></i> {% if section_key %}{{ section_key }}{% else %}API Endpoints{% endif %} <span class="arrow"></span></a>
</li> </li>
<ul class="sub-menu {% if section_key %}collapse{% endif %}" id="{{ section_key }}-dropdown"> <ul class="sub-menu {% if section_key %}collapse{% endif %}" id="{{ section_key }}-dropdown">
{% for link_key, link in section.links.items %} {% for link_key, link in section.links|items %}
<li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li> <li><a href="#{{ section_key }}-{{ link_key }}">{{ link.title|default:link_key }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@ -9,14 +9,14 @@
<div class="col-sm-10"> <div class="col-sm-10">
{% if style.inline %} {% if style.inline %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<label class="checkbox-inline"> <label class="checkbox-inline">
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>
{{ text }} {{ text }}
</label> </label>
{% endfor %} {% endfor %}
{% else %} {% else %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>

View File

@ -19,7 +19,7 @@
</label> </label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %} />
{{ text }} {{ text }}
@ -34,7 +34,7 @@
</label> </label>
</div> </div>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %} /> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %} />

View File

@ -5,7 +5,7 @@
<label class="sr-only">{{ field.label }}</label> <label class="sr-only">{{ field.label }}</label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>

View File

@ -18,7 +18,7 @@
</div> </div>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}>

View File

@ -7,7 +7,7 @@
{% if style.inline %} {% if style.inline %}
<div> <div>
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<label class="checkbox-inline"> <label class="checkbox-inline">
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>
{{ text }} {{ text }}
@ -15,7 +15,7 @@
{% endfor %} {% endfor %}
</div> </div>
{% else %} {% else %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}> <input type="checkbox" name="{{ field.name }}" value="{{ key }}" {% if key|as_string in field.value|as_list_of_strings %}checked{% endif %}>

View File

@ -18,7 +18,7 @@
</label> </label>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}>
{{ text }} {{ text }}
@ -35,7 +35,7 @@
</div> </div>
{% endif %} {% endif %}
{% for key, text in field.choices.items %} {% for key, text in field.choices|items %}
<div class="radio"> <div class="radio">
<label> <label>
<input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}> <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key|as_string == field.value|as_string %}checked{% endif %}>