Skip to content

Commit 4260531

Browse files
beruiccarltongibson
authored andcommitted
Render descriptions (from help_text) using safe (#5869)
To allow embedded HTML, and make consistent with other usages. Fixes #5715.
1 parent 5ee0e5d commit 4260531

File tree

1 file changed

+5
-5
lines changed
  • rest_framework/templates/rest_framework/docs

1 file changed

+5
-5
lines changed

rest_framework/templates/rest_framework/docs/link.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h4>Path Parameters</h4>
2929
</thead>
3030
<tbody>
3131
{% for field in link.fields|with_location:'path' %}
32-
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
32+
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description|safe }}{% endif %}</td></tr>
3333
{% endfor %}
3434
</tbody>
3535
</table>
@@ -43,7 +43,7 @@ <h4>Query Parameters</h4>
4343
</thead>
4444
<tbody>
4545
{% for field in link.fields|with_location:'query' %}
46-
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
46+
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description|safe }}{% endif %}</td></tr>
4747
{% endfor %}
4848
</tbody>
4949
</table>
@@ -57,7 +57,7 @@ <h4>Header Parameters</h4>
5757
</thead>
5858
<tbody>
5959
{% for field in link.fields|with_location:'header' %}
60-
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
60+
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description|safe }}{% endif %}</td></tr>
6161
{% endfor %}
6262
</tbody>
6363
</table>
@@ -71,7 +71,7 @@ <h4>Request Body</h4>
7171
</thead>
7272
<tbody>
7373
{% for field in link.fields|with_location:'body' %}
74-
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
74+
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description|safe }}{% endif %}</td></tr>
7575
{% endfor %}
7676
</tbody>
7777
</table>
@@ -84,7 +84,7 @@ <h4>Request Body</h4>
8484
</thead>
8585
<tbody>
8686
{% for field in link.fields|with_location:'form' %}
87-
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description }}{% endif %}</td></tr>
87+
<tr><td class="parameter-name"><code>{{ field.name }}</code>{% if field.required %} <span class="label label-warning">required</span>{% endif %}</td><td>{% if field.schema.description %}{{ field.schema.description|safe }}{% endif %}</td></tr>
8888
{% endfor %}
8989
</tbody>
9090
</table>

0 commit comments

Comments
 (0)