django-rest-framework/djangorestframework/templates/renderer.html

130 lines
4.5 KiB
HTML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
2011-12-11 22:52:55 +04:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
{% load urlize_quoted_links %}
{% load add_query_param %}
{% load static %}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}css/djangorestframework.css'/>
<title>Django REST framework - {{ name }}</title>
</head>
<body>
<div id="container">
2011-12-11 22:52:55 +04:00
<div id="header">
<div id="branding">
2011-06-26 01:07:06 +04:00
<h1 id="site-name"><a href='http://django-rest-framework.org'>Django REST framework</a> <span class="version"> v {{ version }}</span></h1>
</div>
<div id="user-tools">
{% if user.is_active %}Welcome, {{ user }}.{% if logout_url %} <a href='{{ logout_url }}'>Log out</a>{% endif %}{% else %}Anonymous {% if login_url %}<a href='{{ login_url }}'>Log in</a>{% endif %}{% endif %}
</div>
</div>
2011-12-11 22:52:55 +04:00
<div class="breadcrumbs">
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
<a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a> {% if not forloop.last %}&rsaquo;{% endif %}
{% endfor %}
</div>
<div id="content" class="{% block coltype %}colM{% endblock %}">
2011-12-11 22:52:55 +04:00
{% if 'OPTIONS' in view.allowed_methods %}
<form action="{{ request.get_full_path }}" method="post">
{% csrf_token %}
<input type="hidden" name="{{ METHOD_PARAM }}" value="OPTIONS" />
<input type="submit" value="OPTIONS" class="default" />
</form>
{% endif %}
<div class='content-main'>
<h1>{{ name }}</h1>
2012-01-28 18:38:06 +04:00
<p>{{ description }}</p>
<div class='module'>
2012-02-10 13:05:20 +04:00
<pre><b>{{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
{% for key, val in response.headers.items %}<b>{{ key }}:</b> {{ val|urlize_quoted_links }}
{% endfor %}
{{ content|urlize_quoted_links }}</pre>{% endautoescape %}</div>
2011-05-12 18:11:14 +04:00
{% if 'GET' in view.allowed_methods %}
<form>
<fieldset class='module aligned'>
<h2>GET {{ name }}</h2>
<div class='submit-row' style='margin: 0; border: 0'>
2011-05-31 17:40:30 +04:00
<a href='{{ request.get_full_path }}' rel="nofollow" style='float: left'>GET</a>
{% for format in available_formats %}
{% with FORMAT_PARAM|add:"="|add:format as param %}
[<a href='{{ request.get_full_path|add_query_param:param }}' rel="nofollow">{{ format }}</a>]
{% endwith %}
{% endfor %}
</div>
</fieldset>
</form>
{% endif %}
2011-12-11 22:52:55 +04:00
{# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled and the user has permissions on this view. #}
2012-02-10 13:05:20 +04:00
{% if METHOD_PARAM and response.status_code != 403 %}
2011-05-12 18:11:14 +04:00
{% if 'POST' in view.allowed_methods %}
2011-05-31 17:40:30 +04:00
<form action="{{ request.get_full_path }}" method="post" {% if post_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
<fieldset class='module aligned'>
<h2>POST {{ name }}</h2>
{% 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 %}
<div class='submit-row' style='margin: 0; border: 0'>
<input type="submit" value="POST" class="default" />
</div>
</fieldset>
</form>
{% endif %}
2011-12-11 22:52:55 +04:00
2011-05-12 18:11:14 +04:00
{% if 'PUT' in view.allowed_methods %}
2011-05-31 17:40:30 +04:00
<form action="{{ request.get_full_path }}" method="post" {% if put_form.is_multipart %}enctype="multipart/form-data"{% endif %}>
<fieldset class='module aligned'>
<h2>PUT {{ name }}</h2>
2011-05-12 18:11:14 +04:00
<input type="hidden" name="{{ METHOD_PARAM }}" 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>
2011-12-11 22:52:55 +04:00
{{ field.errors }}
</div>
{% endfor %}
2011-12-11 22:52:55 +04:00
<div class='submit-row' style='margin: 0; border: 0'>
<input type="submit" value="PUT" class="default" />
</div>
</fieldset>
</form>
{% endif %}
2011-12-11 22:52:55 +04:00
2011-05-12 18:11:14 +04:00
{% if 'DELETE' in view.allowed_methods %}
2011-05-31 17:40:30 +04:00
<form action="{{ request.get_full_path }}" method="post">
2011-12-11 22:52:55 +04:00
<fieldset class='module aligned'>
<h2>DELETE {{ name }}</h2>
{% csrf_token %}
2011-05-12 18:11:14 +04:00
<input type="hidden" name="{{ METHOD_PARAM }}" value="DELETE" />
2011-12-11 22:52:55 +04:00
<div class='submit-row' style='margin: 0; border: 0'>
<input type="submit" value="DELETE" class="default" />
</div>
</fieldset>
</form>
{% endif %}
{% endif %}
</div>
</div>
</div>
</body>
</html>