mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-28 02:03:11 +03:00
191 lines
8.4 KiB
HTML
191 lines
8.4 KiB
HTML
{% load url from future %}
|
|
{% load urlize_quoted_links %}
|
|
{% load add_query_param %}
|
|
{% load optional_login %}
|
|
{% load static %}
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
|
|
|
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/bootstrap.min.css'/>
|
|
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>
|
|
{% block extrastyle %}{% endblock %}
|
|
|
|
<title>{% block title %}Django REST framework - {{ name }}{% endblock %}</title>
|
|
|
|
{% block extrahead %}{% endblock %}
|
|
|
|
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
|
|
|
|
</head>
|
|
|
|
<body class="{% block bodyclass %}{% endblock %} container">
|
|
|
|
<div class="navbar">
|
|
<div class="navbar-inner">
|
|
<span class="brand" href="/">
|
|
{% block branding %}<a href='http://django-rest-framework.org'>Django REST framework</a> <span class="version">{{ version }}</span>{% endblock %}
|
|
</span>
|
|
<ul class="nav pull-right">
|
|
{% block userlinks %}
|
|
{% if user.is_active %}
|
|
<li class="dropdown">
|
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
Welcome, {{ user }}
|
|
<b class="caret"></b>
|
|
</a>
|
|
<ul class="dropdown-menu">
|
|
<li>{% optional_logout %}</li>
|
|
</ul>
|
|
</li>
|
|
{% else %}
|
|
<li>{% optional_login %}</li>
|
|
{% endif %}
|
|
{% endblock %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
{% block nav-global %}{% endblock %}
|
|
|
|
|
|
{% block breadcrumbs %}
|
|
<ul class="breadcrumb">
|
|
|
|
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
|
|
<li>
|
|
<a href="{{ breadcrumb_url }}" {% if forloop.last %}class="active"{% endif %}>{{ breadcrumb_name }}</a> {% if not forloop.last %}<span class="divider">›</span>{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endblock %}
|
|
|
|
<!-- Content -->
|
|
<div id="content">
|
|
|
|
{% if api_settings.FORM_METHOD_OVERRIDE %}
|
|
<form id="options-form" action="{{ request.get_full_path }}" method="post" class="pull-right">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="OPTIONS" />
|
|
<button class="btn js-tooltip" {% if 'OPTIONS' in allowed_methods %} title="Do an OPTIONS request on the {{ name }} resource"{% else %} disabled{% endif %}>OPTIONS</button>
|
|
{% if not 'OPTIONS' in allowed_methods %}
|
|
<div class="js-tooltip disabled-tooltip-shield" title="OPTIONS request not allowed for resource {{ name }}"></div>
|
|
{% endif %}
|
|
</form>
|
|
{% endif %}
|
|
|
|
<div class="content-main">
|
|
<div class="page-header"><h1>{{ name }}</h1></div>
|
|
<p class="resource-description">{{ description }}</p>
|
|
|
|
<h2>Request / Response</h2>
|
|
<div class="request-info">
|
|
<pre><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
|
|
<div>
|
|
<div class="response-info">
|
|
<pre><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
|
|
{% for key, val in response.items %}<b>{{ key }}:</b> {{ val|urlize_quoted_links }}
|
|
{% endfor %}
|
|
{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
|
|
</div>
|
|
|
|
<h2>Available Methods & Formats</h2>
|
|
|
|
{% if 'GET' in allowed_methods %}
|
|
<form>
|
|
<fieldset>
|
|
<h3>GET: {{ name }}</h3>
|
|
|
|
<div class="btn-group format-selection">
|
|
<a class="btn btn-primary js-tooltip" href='{{ request.get_full_path }}' rel="nofollow" title="Do a GET request on the {{ name }} resource">GET</a>
|
|
{% for format in available_formats %}
|
|
{% with FORMAT_PARAM|add:"="|add:format as param %}
|
|
<a class="btn js-tooltip format-option" href='{{ request.get_full_path|add_query_param:param }}' rel="nofollow" title="Do a GET request on the {{ name }} resource with the format set to `{{ format }}`">{{ format }}</a>
|
|
{% endwith %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
</fieldset>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if response.status_code != 403 %}
|
|
|
|
{% if 'POST' in allowed_methods %}
|
|
<form action="{{ request.get_full_path }}" method="POST" {% if post_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
|
|
<fieldset class='module aligned'>
|
|
<h3>POST: {{ name }}</h3>
|
|
{% csrf_token %}
|
|
{{ post_form.non_field_errors }}
|
|
{% for field in post_form %}
|
|
<div class='form-row'>
|
|
{{ field.label_tag }}
|
|
{{ field }}
|
|
<span class='help'>{{ field.help_text }}</span>
|
|
{{ field.errors }}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<button class="btn btn-primary" title="Do a POST request on the {{ name }} resource">POST</button>
|
|
</fieldset>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if 'PUT' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %}
|
|
<form action="{{ request.get_full_path }}" method="POST" {% if put_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
|
|
<fieldset class='module aligned'>
|
|
<h3>PUT: {{ name }}</h3>
|
|
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="PUT" />
|
|
{% csrf_token %}
|
|
{{ put_form.non_field_errors }}
|
|
{% for field in put_form %}
|
|
<div class='form-row'>
|
|
{{ field.label_tag }}
|
|
{{ field }}
|
|
<span class='help'>{{ field.help_text }}</span>
|
|
{{ field.errors }}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<button class="btn btn-primary js-tooltip" title="Do a PUT request on the {{ name }} resource">PUT</button>
|
|
|
|
</fieldset>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% if 'DELETE' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %}
|
|
<form action="{{ request.get_full_path }}" method="POST">
|
|
<fieldset class='module aligned'>
|
|
<h3>DELETE: {{ name }}</h3>
|
|
{% csrf_token %}
|
|
<input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="DELETE" />
|
|
<button class="btn btn-danger js-tooltip" title="Do a DELETE request on the {{ name }} resource">DELETE</button>
|
|
</fieldset>
|
|
</form>
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
<!-- END content-main -->
|
|
|
|
</div>
|
|
<!-- END Content -->
|
|
|
|
<div id="footer">
|
|
{% block footer %}
|
|
<a class="powered-by" href='http://django-rest-framework.org'>Django REST framework</a> <span class="version">{{ version }}</span>
|
|
{% endblock %}
|
|
</div>
|
|
</div>
|
|
<script src="{% get_static_prefix %}djangorestframework/js/jquery-1.8.1-min.js"></script>
|
|
<script src="{% get_static_prefix %}djangorestframework/js/bootstrap.min.js"></script>
|
|
<script>
|
|
$('.js-tooltip').tooltip({
|
|
delay: 1000
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|