Rename templates to 'base.html', 'api.html', 'api.txt' and 'login.html'

This commit is contained in:
Paul Oswald 2012-02-20 22:16:51 +09:00
parent bf717eff64
commit 50198935af
7 changed files with 9 additions and 9 deletions

View File

@ -373,7 +373,7 @@ class DocumentingHTMLRenderer(DocumentingTemplateRenderer):
media_type = 'text/html' media_type = 'text/html'
format = 'html' format = 'html'
template = 'djangorestframework/renderer.html' template = 'djangorestframework/api.html'
class DocumentingXHTMLRenderer(DocumentingTemplateRenderer): class DocumentingXHTMLRenderer(DocumentingTemplateRenderer):
@ -385,7 +385,7 @@ class DocumentingXHTMLRenderer(DocumentingTemplateRenderer):
media_type = 'application/xhtml+xml' media_type = 'application/xhtml+xml'
format = 'xhtml' format = 'xhtml'
template = 'djangorestframework/renderer.html' template = 'djangorestframework/api.html'
class DocumentingPlainTextRenderer(DocumentingTemplateRenderer): class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
@ -397,7 +397,7 @@ class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
media_type = 'text/plain' media_type = 'text/plain'
format = 'txt' format = 'txt'
template = 'djangorestframework/renderer.txt' template = 'djangorestframework/api.txt'
DEFAULT_RENDERERS = ( DEFAULT_RENDERERS = (

View File

@ -1,3 +1,3 @@
{% extends "djangorestframework/base_renderer.html" %} {% extends "djangorestframework/base.html" %}
{# Override this template in your own templates directory to customize #} {# Override this template in your own templates directory to customize #}

View File

@ -12,7 +12,7 @@ import base64
# be making settings changes in order to accomodate django-rest-framework # be making settings changes in order to accomodate django-rest-framework
@csrf_protect @csrf_protect
@never_cache @never_cache
def api_login(request, template_name='djangorestframework/api_login.html', def api_login(request, template_name='djangorestframework/login.html',
redirect_field_name=REDIRECT_FIELD_NAME, redirect_field_name=REDIRECT_FIELD_NAME,
authentication_form=AuthenticationForm): authentication_form=AuthenticationForm):
"""Displays the login form and handles the login action.""" """Displays the login form and handles the login action."""
@ -57,5 +57,5 @@ def api_login(request, template_name='djangorestframework/api_login.html',
}, context_instance=RequestContext(request)) }, context_instance=RequestContext(request))
def api_logout(request, next_page=None, template_name='djangorestframework/api_login.html', redirect_field_name=REDIRECT_FIELD_NAME): def api_logout(request, next_page=None, template_name='djangorestframework/login.html', redirect_field_name=REDIRECT_FIELD_NAME):
return logout(request, next_page, template_name, redirect_field_name) return logout(request, next_page, template_name, redirect_field_name)

View File

@ -29,11 +29,11 @@ but once you move onto a production server, you'll want to make sure you serve t
* Ensure that the ``ADMIN_MEDIA_PREFIX`` is set appropriately and that you are serving the admin media. * Ensure that the ``ADMIN_MEDIA_PREFIX`` is set appropriately and that you are serving the admin media.
(Django's testserver will automatically serve the admin media for you) (Django's testserver will automatically serve the admin media for you)
You may customize the templates by creating a new template called ``djangorestframework/renderer.html`` You may customize the templates by creating a new template called ``djangorestframework/api.html``
in your project, extend ``djangorestframework/base_renderer.html`` and override the in your project, extend ``djangorestframework/base.html`` and override the
appropriate ``{% block tags %}``. For example:: appropriate ``{% block tags %}``. For example::
{% extends "djangorestframework/base_renderer.html" %} {% extends "djangorestframework/base.html" %}
{% block title %}My API{% endblock %} {% block title %}My API{% endblock %}