Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
2fea12c8
Commit
2fea12c8
authored
Feb 20, 2012
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #168 from poswald/namespace-templates
Namespace templates
parents
87a9072b
50198935
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
8 deletions
+38
-8
djangorestframework/renderers.py
+3
-3
djangorestframework/templates/djangorestframework/api.html
+4
-0
djangorestframework/templates/djangorestframework/api.txt
+0
-0
djangorestframework/templates/djangorestframework/base.html
+16
-3
djangorestframework/templates/djangorestframework/login.html
+0
-0
djangorestframework/utils/staticviews.py
+2
-2
docs/howto/setup.rst
+13
-0
No files found.
djangorestframework/renderers.py
View file @
2fea12c8
...
@@ -373,7 +373,7 @@ class DocumentingHTMLRenderer(DocumentingTemplateRenderer):
...
@@ -373,7 +373,7 @@ class DocumentingHTMLRenderer(DocumentingTemplateRenderer):
media_type
=
'text/html'
media_type
=
'text/html'
format
=
'html'
format
=
'html'
template
=
'
renderer
.html'
template
=
'
djangorestframework/api
.html'
class
DocumentingXHTMLRenderer
(
DocumentingTemplateRenderer
):
class
DocumentingXHTMLRenderer
(
DocumentingTemplateRenderer
):
...
@@ -385,7 +385,7 @@ 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
=
'
renderer
.html'
template
=
'
djangorestframework/api
.html'
class
DocumentingPlainTextRenderer
(
DocumentingTemplateRenderer
):
class
DocumentingPlainTextRenderer
(
DocumentingTemplateRenderer
):
...
@@ -397,7 +397,7 @@ class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
...
@@ -397,7 +397,7 @@ class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
media_type
=
'text/plain'
media_type
=
'text/plain'
format
=
'txt'
format
=
'txt'
template
=
'
renderer
.txt'
template
=
'
djangorestframework/api
.txt'
DEFAULT_RENDERERS
=
(
DEFAULT_RENDERERS
=
(
...
...
djangorestframework/templates/djangorestframework/api.html
0 → 100644
View file @
2fea12c8
{% extends "djangorestframework/base.html" %}
{# Override this template in your own templates directory to customize #}
\ No newline at end of file
djangorestframework/templates/
renderer
.txt
→
djangorestframework/templates/
djangorestframework/api
.txt
View file @
2fea12c8
File moved
djangorestframework/templates/
renderer
.html
→
djangorestframework/templates/
djangorestframework/base
.html
View file @
2fea12c8
...
@@ -7,26 +7,34 @@
...
@@ -7,26 +7,34 @@
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<head>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}djangorestframework/css/style.css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{% get_static_prefix %}djangorestframework/css/style.css'
/>
<title>
Django REST framework - {{ name }}
</title>
{% 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>
</head>
<body>
<body
class=
"{% block bodyclass %}{% endblock %}"
>
<div
id=
"container"
>
<div
id=
"container"
>
<div
id=
"header"
>
<div
id=
"header"
>
<div
id=
"branding"
>
<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>
<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>
<div
id=
"user-tools"
>
<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 %}
{% 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>
</div>
{% block nav-global %}{% endblock %}
</div>
</div>
<div
class=
"breadcrumbs"
>
<div
class=
"breadcrumbs"
>
{% block breadcrumbs %}
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
{% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
<a
href=
"{{ breadcrumb_url }}"
>
{{ breadcrumb_name }}
</a>
{% if not forloop.last %}
›
{% endif %}
<a
href=
"{{ breadcrumb_url }}"
>
{{ breadcrumb_name }}
</a>
{% if not forloop.last %}
›
{% endif %}
{% endfor %}
{% endfor %}
{% endblock %}
</div>
</div>
<!-- Content -->
<div
id=
"content"
class=
"{% block coltype %}colM{% endblock %}"
>
<div
id=
"content"
class=
"{% block coltype %}colM{% endblock %}"
>
{% if 'OPTIONS' in view.allowed_methods %}
{% if 'OPTIONS' in view.allowed_methods %}
...
@@ -123,7 +131,12 @@
...
@@ -123,7 +131,12 @@
{% endif %}
{% endif %}
</div>
</div>
<!-- END content-main -->
</div>
</div>
<!-- END Content -->
{% block footer %}
<div
id=
"footer"
></div>
{% endblock %}
</div>
</div>
</body>
</body>
</html>
</html>
djangorestframework/templates/
api_
login.html
→
djangorestframework/templates/
djangorestframework/
login.html
View file @
2fea12c8
File moved
djangorestframework/utils/staticviews.py
View file @
2fea12c8
...
@@ -12,7 +12,7 @@ import base64
...
@@ -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
=
'
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='api_login.html',
...
@@ -57,5 +57,5 @@ def api_login(request, template_name='api_login.html',
},
context_instance
=
RequestContext
(
request
))
},
context_instance
=
RequestContext
(
request
))
def
api_logout
(
request
,
next_page
=
None
,
template_name
=
'
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
)
docs/howto/setup.rst
View file @
2fea12c8
...
@@ -29,6 +29,19 @@ but once you move onto a production server, you'll want to make sure you serve t
...
@@ -29,6 +29,19 @@ 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/api.html``
in your project, extend ``djangorestframework/base.html`` and override the
appropriate ``{% block tags %}``. For example::
{% extends "djangorestframework/base.html" %}
{% block title %}My API{% endblock %}
{% block branding %}
<h1 id="site-name">My API</h1>
{% endblock %}
Markdown
Markdown
--------
--------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment