2011-01-24 02:08:16 +03:00
|
|
|
{% load urlize_quoted_links %}{% load add_query_param %}<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
|
|
<style>
|
|
|
|
pre {border: 1px solid black; padding: 1em; background: #ffd}
|
2011-01-28 00:09:25 +03:00
|
|
|
body {margin: 0; border:0; padding: 0;}
|
|
|
|
span.api {margin: 0.5em 1em}
|
|
|
|
span.auth {float: right; margin-right: 1em}
|
|
|
|
div.header {margin: 0; border:0; padding: 0.25em 0; background: #ddf}
|
|
|
|
div.content {margin: 0 1em;}
|
2011-01-24 02:08:16 +03:00
|
|
|
div.action {border: 1px solid black; padding: 0.5em 1em; margin-bottom: 0.5em; background: #ddf}
|
|
|
|
ul.accepttypes {float: right; list-style-type: none; margin: 0; padding: 0}
|
|
|
|
ul.accepttypes li {display: inline;}
|
|
|
|
form div {margin: 0.5em 0}
|
|
|
|
form div * {vertical-align: top}
|
|
|
|
form ul.errorlist {display: inline; margin: 0; padding: 0}
|
|
|
|
form ul.errorlist li {display: inline; color: red;}
|
|
|
|
.clearing {display: block; margin: 0; padding: 0; clear: both;}
|
|
|
|
</style>
|
|
|
|
<title>API - {{ resource.name }}</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2011-01-28 00:09:25 +03:00
|
|
|
<div class='header'>
|
|
|
|
<span class='api'><a href='http://www.thewebhaswon.com/flywheel/'>FlyWheel API</a></span>
|
|
|
|
<span class='auth'>{% if user.is_active %}Welcome, {{ user }}.{% if logout_url %} <a href='{{ logout_url }}'>Log out</a>{% endif %}{% else %}Not logged in {% if login_url %}<a href='{{ login_url }}'>Log in</a>{% endif %}{% endif %}</span>
|
2011-01-24 02:08:16 +03:00
|
|
|
</div>
|
2011-01-28 00:09:25 +03:00
|
|
|
<div class='content'>
|
|
|
|
<h1>{{ resource.name }}</h1>
|
|
|
|
<p>{{ resource.description|linebreaksbr }}</p>
|
|
|
|
<pre><b>{{ response.status }} {{ response.status_text }}</b>{% autoescape off %}
|
2011-01-28 20:42:57 +03:00
|
|
|
{% for key, val in response.headers.items %}<b>{{ key }}:</b> {{ val|urlize_quoted_links }}
|
|
|
|
{% endfor %}
|
|
|
|
{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
|
2011-01-24 02:08:16 +03:00
|
|
|
|
2011-01-28 00:09:25 +03:00
|
|
|
{% if 'GET' in resource.allowed_methods %}
|
2011-01-24 02:08:16 +03:00
|
|
|
<div class='action'>
|
2011-01-28 00:19:25 +03:00
|
|
|
<a href='{{ request.path }}' rel="nofollow">GET</a>
|
2011-01-28 00:09:25 +03:00
|
|
|
<ul class="accepttypes">
|
|
|
|
{% for media_type in resource.emitted_media_types %}
|
|
|
|
{% with resource.ACCEPT_QUERY_PARAM|add:"="|add:media_type as param %}
|
2011-01-28 20:42:57 +03:00
|
|
|
<li>[<a href='{{ request.path|add_query_param:param }}' rel="nofollow">{{ media_type }}</a>]</li>
|
2011-01-28 00:09:25 +03:00
|
|
|
{% endwith %}
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
<div class="clearing"></div>
|
2011-01-24 02:08:16 +03:00
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
2011-01-28 00:09:25 +03:00
|
|
|
{% comment %} *** Only display the POST/PUT/DELETE forms if we have a bound form, and if method ***
|
|
|
|
*** tunneling via POST forms is enabled. ***
|
|
|
|
*** (We could display only the POST form if method tunneling is disabled, but I think ***
|
|
|
|
*** the user experience would be confusing, so we simply turn all forms off. *** {% endcomment %}
|
|
|
|
|
|
|
|
{% if resource.METHOD_PARAM and form %}
|
|
|
|
{% if 'POST' in resource.allowed_methods %}
|
|
|
|
<div class='action'>
|
|
|
|
<form action="{{ request.path }}" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
{{ form.non_field_errors }}
|
|
|
|
{% for field in form %}
|
|
|
|
<div>
|
|
|
|
{{ field.label_tag }}:
|
|
|
|
{{ field }}
|
|
|
|
{{ field.help_text }}
|
|
|
|
{{ field.errors }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<div class="clearing"></div>
|
|
|
|
<input type="submit" value="POST" />
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if 'PUT' in resource.allowed_methods %}
|
|
|
|
<div class='action'>
|
|
|
|
<form action="{{ request.path }}" method="post">
|
|
|
|
<input type="hidden" name="{{ resource.METHOD_PARAM }}" value="PUT" />
|
|
|
|
{% csrf_token %}
|
|
|
|
{{ form.non_field_errors }}
|
|
|
|
{% for field in form %}
|
|
|
|
<div>
|
|
|
|
{{ field.label_tag }}:
|
|
|
|
{{ field }}
|
|
|
|
{{ field.help_text }}
|
|
|
|
{{ field.errors }}
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<div class="clearing"></div>
|
|
|
|
<input type="submit" value="PUT" />
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if 'DELETE' in resource.allowed_methods %}
|
|
|
|
<div class='action'>
|
|
|
|
<form action="{{ request.path }}" method="post">
|
|
|
|
{% csrf_token %}
|
|
|
|
<input type="hidden" name="{{ resource.METHOD_PARAM }}" value="DELETE" />
|
|
|
|
<input type="submit" value="DELETE" />
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2011-01-24 02:08:16 +03:00
|
|
|
{% endif %}
|
2011-01-28 00:09:25 +03:00
|
|
|
</div>
|
2011-01-24 02:08:16 +03:00
|
|
|
</body>
|
|
|
|
</html>
|