aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Oswald2012-02-15 10:21:02 +0900
committerPaul Oswald2012-02-15 10:21:02 +0900
commite0f7d2cd9f9ef1f9788d402b6a2861946d4c2fc9 (patch)
treef411c180be3238faccb37d78831acb805bd20cc3
parent78daa32566cbdc9016d6c4df5429feb9684c8032 (diff)
downloaddjango-rest-framework-e0f7d2cd9f9ef1f9788d402b6a2861946d4c2fc9.tar.bz2
Add empty {% blocks %} to the template to give people a chance to override
-rw-r--r--djangorestframework/templates/base_renderer.html142
-rw-r--r--djangorestframework/templates/renderer.html130
2 files changed, 144 insertions, 128 deletions
diff --git a/djangorestframework/templates/base_renderer.html b/djangorestframework/templates/base_renderer.html
new file mode 100644
index 00000000..1d4ae92a
--- /dev/null
+++ b/djangorestframework/templates/base_renderer.html
@@ -0,0 +1,142 @@
+<?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">
+{% 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 %}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 %}">
+ <div id="container">
+
+ <div id="header">
+ <div id="branding">
+ <h1 id="site-name">{% block branding %}<a href='http://django-rest-framework.org'>Django REST framework</a> <span class="version"> v {{ version }}</span>{% endblock %}</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 %}
+ {% block userlinks %}{% endblock %}
+ </div>
+ {% block nav-global %}{% endblock %}
+ </div>
+
+ <div class="breadcrumbs">
+ {% block breadcrumbs %}
+ {% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
+ <a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a> {% if not forloop.last %}&rsaquo;{% endif %}
+ {% endfor %}
+ {% endblock %}
+ </div>
+
+ <!-- Content -->
+ <div id="content" class="{% block coltype %}colM{% endblock %}">
+
+ {% 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>
+ <p>{{ description }}</p>
+ <div class='module'>
+ <pre><b>{{ response.status }} {{ 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>
+
+ {% if 'GET' in view.allowed_methods %}
+ <form>
+ <fieldset class='module aligned'>
+ <h2>GET {{ name }}</h2>
+ <div class='submit-row' style='margin: 0; border: 0'>
+ <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 %}
+
+ {# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled and the user has permissions on this view. #}
+ {% if METHOD_PARAM and response.status != 403 %}
+
+ {% if 'POST' in view.allowed_methods %}
+ <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 %}
+
+ {% if 'PUT' in view.allowed_methods %}
+ <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>
+ <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>
+ {{ field.errors }}
+ </div>
+ {% endfor %}
+ <div class='submit-row' style='margin: 0; border: 0'>
+ <input type="submit" value="PUT" class="default" />
+ </div>
+ </fieldset>
+ </form>
+ {% endif %}
+
+ {% if 'DELETE' in view.allowed_methods %}
+ <form action="{{ request.get_full_path }}" method="post">
+ <fieldset class='module aligned'>
+ <h2>DELETE {{ name }}</h2>
+ {% csrf_token %}
+ <input type="hidden" name="{{ METHOD_PARAM }}" value="DELETE" />
+ <div class='submit-row' style='margin: 0; border: 0'>
+ <input type="submit" value="DELETE" class="default" />
+ </div>
+ </fieldset>
+ </form>
+ {% endif %}
+
+ {% endif %}
+ </div>
+ <!-- END content-main -->
+
+ </div>
+ <!-- END Content -->
+
+ {% block footer %}<div id="footer"></div>{% endblock %}
+ </div>
+ </body>
+</html>
diff --git a/djangorestframework/templates/renderer.html b/djangorestframework/templates/renderer.html
index bda49e6f..adb42c7f 100644
--- a/djangorestframework/templates/renderer.html
+++ b/djangorestframework/templates/renderer.html
@@ -1,129 +1,3 @@
-<?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">
-{% 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 %}djangorestframework/css/style.css'/>
- <title>Django REST framework - {{ name }}</title>
- </head>
- <body>
- <div id="container">
+{% extends "base_renderer.html" %}
- <div id="header">
- <div id="branding">
- <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>
-
- <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 %}">
-
- {% 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>
- <p>{{ description }}</p>
- <div class='module'>
- <pre><b>{{ response.status }} {{ 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>
-
- {% if 'GET' in view.allowed_methods %}
- <form>
- <fieldset class='module aligned'>
- <h2>GET {{ name }}</h2>
- <div class='submit-row' style='margin: 0; border: 0'>
- <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 %}
-
- {# Only display the POST/PUT/DELETE forms if method tunneling via POST forms is enabled and the user has permissions on this view. #}
- {% if METHOD_PARAM and response.status != 403 %}
-
- {% if 'POST' in view.allowed_methods %}
- <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 %}
-
- {% if 'PUT' in view.allowed_methods %}
- <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>
- <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>
- {{ field.errors }}
- </div>
- {% endfor %}
- <div class='submit-row' style='margin: 0; border: 0'>
- <input type="submit" value="PUT" class="default" />
- </div>
- </fieldset>
- </form>
- {% endif %}
-
- {% if 'DELETE' in view.allowed_methods %}
- <form action="{{ request.get_full_path }}" method="post">
- <fieldset class='module aligned'>
- <h2>DELETE {{ name }}</h2>
- {% csrf_token %}
- <input type="hidden" name="{{ METHOD_PARAM }}" value="DELETE" />
- <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>
+{# Override this template in your own templates directory to customize #} \ No newline at end of file