aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/templates
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/templates')
-rw-r--r--rest_framework/templates/rest_framework/api.html3
-rw-r--r--rest_framework/templates/rest_framework/api.txt8
-rw-r--r--rest_framework/templates/rest_framework/base.html214
-rw-r--r--rest_framework/templates/rest_framework/login.html45
4 files changed, 270 insertions, 0 deletions
diff --git a/rest_framework/templates/rest_framework/api.html b/rest_framework/templates/rest_framework/api.html
new file mode 100644
index 00000000..81d277e9
--- /dev/null
+++ b/rest_framework/templates/rest_framework/api.html
@@ -0,0 +1,3 @@
+{% extends "rest_framework/base.html" %}
+
+{# Override this template in your own templates directory to customize #}
diff --git a/rest_framework/templates/rest_framework/api.txt b/rest_framework/templates/rest_framework/api.txt
new file mode 100644
index 00000000..c87a154c
--- /dev/null
+++ b/rest_framework/templates/rest_framework/api.txt
@@ -0,0 +1,8 @@
+{% autoescape off %}{{ name }}
+
+{{ description }}
+
+HTTP {{ response.status_code }} {{ response.status_text }}
+{% for key, val in response.headers.items %}{{ key }}: {{ val }}
+{% endfor %}
+{{ content }}{% endautoescape %}
diff --git a/rest_framework/templates/rest_framework/base.html b/rest_framework/templates/rest_framework/base.html
new file mode 100644
index 00000000..9227c0af
--- /dev/null
+++ b/rest_framework/templates/rest_framework/base.html
@@ -0,0 +1,214 @@
+{% load url from future %}
+{% load urlize_quoted_links %}
+{% load add_query_param %}
+{% load add_class %}
+{% load optional_login %}
+{% load static %}
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+
+ {% block bootstrap_theme %}
+ <link rel="stylesheet" type="text/css" href="{% get_static_prefix %}rest_framework/css/bootstrap.min.css"/>
+ <link rel="stylesheet" type="text/css" href="{% get_static_prefix %}rest_framework/css/bootstrap-tweaks.css"/>
+ {% endblock %}
+ <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}rest_framework/css/prettify.css'/>
+ <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}rest_framework/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 navbar-fixed-top {% block bootstrap_navbar_variant %}navbar-inverse{% endblock %}">
+ <div class="navbar-inner">
+ <div class="container">
+ <span class="brand" href="/">
+ {% block branding %}<a href='http://django-rest-framework.org'>Django REST framework <span class="version">{{ version }}</span></a>{% 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>
+ </div>
+
+ {% block global_heading %}{% 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">&rsaquo;</span>{% endif %}
+ </li>
+ {% endfor %}
+ </ul>
+ {% endblock %}
+
+ <!-- Content -->
+ <div id="content">
+
+ {% if 'GET' in allowed_methods %}
+ <form id="get-form" class="pull-right">
+ <fieldset>
+ <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>
+
+ <button class="btn btn-primary dropdown-toggle js-tooltip" data-toggle="dropdown" title="Specify a format for the GET request">
+ <span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu">
+ {% for format in available_formats %}
+ {% with FORMAT_PARAM|add:"="|add:format as param %}
+ <li>
+ <a class="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>
+ </li>
+ {% endwith %}
+ {% endfor %}
+ </ul>
+ </div>
+
+ </fieldset>
+ </form>
+ {% endif %}
+
+ {% 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 btn-info 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>
+
+ <div class="request-info">
+ <pre class="prettyprint"><b>{{ request.method }}</b> {{ request.get_full_path }}</pre>
+ <div>
+ <div class="response-info">
+ <pre class="prettyprint"><div class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}
+{% for key, val in response.items %}<b>{{ key }}:</b> <span class="lit">{{ val|urlize_quoted_links }}</span>
+{% endfor %}
+</div>{{ content|urlize_quoted_links }}</pre>{% endautoescape %}
+ </div>
+
+ {% 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 %} class="form-horizontal">
+ <fieldset>
+ <h2>POST: {{ name }}</h2>
+ {% csrf_token %}
+ {{ post_form.non_field_errors }}
+ {% for field in post_form %}
+ <div class="control-group {% if field.errors %}error{% endif %}">
+ {{ field.label_tag|add_class:"control-label" }}
+ <div class="controls">
+ {{ field }}
+ <span class="help-inline">{{ field.help_text }}</span>
+ {{ field.errors|add_class:"help-block" }}
+ </div>
+ </div>
+ {% endfor %}
+ <div class="form-actions">
+ <button class="btn btn-primary" title="Do a POST request on the {{ name }} resource">POST</button>
+ </div>
+ </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 %} class="form-horizontal">
+ <fieldset>
+ <h2>PUT: {{ name }}</h2>
+ <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="control-group {% if field.errors %}error{% endif %}">
+ {{ field.label_tag|add_class:"control-label" }}
+ <div class="controls">
+ {{ field }}
+ <span class='help-inline'>{{ field.help_text }}</span>
+ {{ field.errors|add_class:"help-block" }}
+ </div>
+ </div>
+ {% endfor %}
+ <div class="form-actions">
+ <button class="btn btn-primary js-tooltip" title="Do a PUT request on the {{ name }} resource">PUT</button>
+ </div>
+
+ </fieldset>
+ </form>
+ {% endif %}
+
+ {% if 'DELETE' in allowed_methods and api_settings.FORM_METHOD_OVERRIDE %}
+ <form action="{{ request.get_full_path }}" method="POST" class="form-horizontal">
+ <fieldset>
+ <h2>DELETE: {{ name }}</h2>
+ {% csrf_token %}
+ <input type="hidden" name="{{ api_settings.FORM_METHOD_OVERRIDE }}" value="DELETE" />
+ <div class="form-actions">
+ <button class="btn btn-danger js-tooltip" title="Do a DELETE request on the {{ name }} resource">DELETE</button>
+ </div>
+ </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 %}rest_framework/js/jquery-1.8.1-min.js"></script>
+ <script src="{% get_static_prefix %}rest_framework/js/bootstrap.min.js"></script>
+ <script src="{% get_static_prefix %}rest_framework/js/prettify-min.js"></script>
+ <script>
+ prettyPrint();
+
+ $('.js-tooltip').tooltip({
+ delay: 1000
+ });
+ </script>
+
+ {% block extrabody %}{% endblock %}
+
+ </body>
+</html>
diff --git a/rest_framework/templates/rest_framework/login.html b/rest_framework/templates/rest_framework/login.html
new file mode 100644
index 00000000..65af512e
--- /dev/null
+++ b/rest_framework/templates/rest_framework/login.html
@@ -0,0 +1,45 @@
+{% load url from future %}
+{% load static %}
+<html>
+
+ <head>
+ <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}rest_framework/css/style.css'/>
+ </head>
+
+ <body class="login">
+
+ <div id="container">
+
+ <div id="header">
+ <div id="branding">
+ <h1 id="site-name">Django REST framework</h1>
+ </div>
+ </div>
+
+ <div id="content" class="colM">
+ <div id="content-main">
+ <form method="post" action="{% url 'rest_framework:login' %}" id="login-form">
+ {% csrf_token %}
+ <div class="form-row">
+ <label for="id_username">Username:</label> {{ form.username }}
+ </div>
+ <div class="form-row">
+ <label for="id_password">Password:</label> {{ form.password }}
+ <input type="hidden" name="next" value="{{ next }}" />
+ </div>
+ <div class="form-row">
+ <label>&nbsp;</label><input type="submit" value="Log in">
+ </div>
+ </form>
+ <script type="text/javascript">
+ document.getElementById('id_username').focus()
+ </script>
+ </div>
+ <br class="clear">
+ </div>
+
+ <div id="footer"></div>
+
+ </div>
+ </body>
+</html>