mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 04:20:12 +03:00
parent
5d10c2eb64
commit
72fe3deb2f
|
@ -13,8 +13,8 @@
|
|||
{% if 'javascript' in langs %}{% include "rest_framework/docs/langs/javascript-intro.html" %}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if document.data %}
|
||||
{% for section_key, section in document.data|items %}
|
||||
{% if document|data %}
|
||||
{% for section_key, section in document|data|items %}
|
||||
{% 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>
|
||||
</a></h2>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<i class="fa fa-bars fa-2x toggle-btn" data-toggle="collapse" data-target="#menu-content"></i>
|
||||
<div class="menu-list">
|
||||
<ul id="menu-content" class="menu-content collapse out">
|
||||
{% if document.data %}
|
||||
{% for section_key, section in document.data|items %}
|
||||
{% if document|data %}
|
||||
{% for section_key, section in document|data|items %}
|
||||
<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>
|
||||
<ul class="sub-menu {% if section_key %}collapse{% endif %}" id="{{ section_key }}-dropdown">
|
||||
|
|
|
@ -245,6 +245,20 @@ def items(value):
|
|||
return value.items()
|
||||
|
||||
|
||||
@register.filter
|
||||
def data(value):
|
||||
"""
|
||||
Simple filter to access `data` attribute of object,
|
||||
specifically coreapi.Document.
|
||||
|
||||
As per `items` filter above, allows accessing `document.data` when
|
||||
Document contains Link keyed-at "data".
|
||||
|
||||
See issue #5395
|
||||
"""
|
||||
return value.data
|
||||
|
||||
|
||||
@register.filter
|
||||
def schema_links(section, sec_key=None):
|
||||
"""
|
||||
|
|
|
@ -27,7 +27,7 @@ def pytest_configure():
|
|||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
"debug": True, # We want template errors to raise
|
||||
"debug": True, # We want template errors to raise
|
||||
}
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user