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
049d417e
Commit
049d417e
authored
Jan 24, 2012
by
Ben Timby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted formatting
parent
7fa3a214
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
16 deletions
+23
-16
djangorestframework/renderers.py
+9
-9
djangorestframework/templates/renderer.html
+8
-3
djangorestframework/views.py
+6
-4
No files found.
djangorestframework/renderers.py
View file @
049d417e
...
@@ -225,7 +225,6 @@ class DocumentingTemplateRenderer(BaseRenderer):
...
@@ -225,7 +225,6 @@ class DocumentingTemplateRenderer(BaseRenderer):
return
content
return
content
def
_get_form_instance
(
self
,
view
,
method
):
def
_get_form_instance
(
self
,
view
,
method
):
"""
"""
Get a form, possibly bound to either the input or output data.
Get a form, possibly bound to either the input or output data.
...
@@ -261,7 +260,6 @@ class DocumentingTemplateRenderer(BaseRenderer):
...
@@ -261,7 +260,6 @@ class DocumentingTemplateRenderer(BaseRenderer):
return
form_instance
return
form_instance
def
_get_generic_content_form
(
self
,
view
):
def
_get_generic_content_form
(
self
,
view
):
"""
"""
Returns a form that allows for arbitrary content types to be tunneled via standard HTML forms
Returns a form that allows for arbitrary content types to be tunneled via standard HTML forms
...
@@ -340,7 +338,7 @@ class DocumentingTemplateRenderer(BaseRenderer):
...
@@ -340,7 +338,7 @@ class DocumentingTemplateRenderer(BaseRenderer):
context
=
RequestContext
(
self
.
view
.
request
,
{
context
=
RequestContext
(
self
.
view
.
request
,
{
'content'
:
content
,
'content'
:
content
,
'view'
:
self
.
view
,
'view'
:
self
.
view
,
'request'
:
self
.
view
.
request
,
# TODO: remove
'request'
:
self
.
view
.
request
,
# TODO: remove
'response'
:
self
.
view
.
response
,
'response'
:
self
.
view
.
response
,
'description'
:
description
,
'description'
:
description
,
'name'
:
name
,
'name'
:
name
,
...
@@ -402,12 +400,14 @@ class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
...
@@ -402,12 +400,14 @@ class DocumentingPlainTextRenderer(DocumentingTemplateRenderer):
template
=
'renderer.txt'
template
=
'renderer.txt'
DEFAULT_RENDERERS
=
(
JSONRenderer
,
DEFAULT_RENDERERS
=
(
JSONPRenderer
,
JSONRenderer
,
DocumentingHTMLRenderer
,
JSONPRenderer
,
DocumentingXHTMLRenderer
,
DocumentingHTMLRenderer
,
DocumentingPlainTextRenderer
,
DocumentingXHTMLRenderer
,
XMLRenderer
)
DocumentingPlainTextRenderer
,
XMLRenderer
)
if
YAMLRenderer
:
if
YAMLRenderer
:
DEFAULT_RENDERERS
+=
(
YAMLRenderer
,)
DEFAULT_RENDERERS
+=
(
YAMLRenderer
,)
djangorestframework/templates/renderer.html
View file @
049d417e
...
@@ -11,9 +11,14 @@
...
@@ -11,9 +11,14 @@
/* Custom styles */
/* Custom styles */
.version
{
font-size
:
8px
;}
.version
{
font-size
:
8px
;}
</style>
</style>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{ADMIN_MEDIA_PREFIX}}css/base.css'
/>
{% if ADMIN_MEDIA_PREFIX %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{ADMIN_MEDIA_PREFIX}}css/forms.css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{ADMIN_MEDIA_PREFIX}}css/base.css'
/>
<title>
Django REST framework - {{ name }}
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{ADMIN_MEDIA_PREFIX}}css/forms.css'
/>
{% else %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{STATIC_URL}}admin/css/base.css'
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
'{{STATIC_URL}}admin/css/forms.css'
/>
{% endif %}
<title>
Django REST framework - {{ name }}
</title>
</head>
</head>
<body>
<body>
<div
id=
"container"
>
<div
id=
"container"
>
...
...
djangorestframework/views.py
View file @
049d417e
...
@@ -27,7 +27,6 @@ __all__ = (
...
@@ -27,7 +27,6 @@ __all__ = (
)
)
class
View
(
ResourceMixin
,
RequestMixin
,
ResponseMixin
,
AuthMixin
,
DjangoView
):
class
View
(
ResourceMixin
,
RequestMixin
,
ResponseMixin
,
AuthMixin
,
DjangoView
):
"""
"""
Handles incoming requests and maps them to REST operations.
Handles incoming requests and maps them to REST operations.
...
@@ -50,13 +49,13 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
...
@@ -50,13 +49,13 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
List of parsers the resource can parse the request with.
List of parsers the resource can parse the request with.
"""
"""
authentication
=
(
authentication
.
UserLoggedInAuthentication
,
authentication
=
(
authentication
.
UserLoggedInAuthentication
,
authentication
.
BasicAuthentication
)
authentication
.
BasicAuthentication
)
"""
"""
List of all authenticating methods to attempt.
List of all authenticating methods to attempt.
"""
"""
permissions
=
(
permissions
.
FullAnonAccess
,
)
permissions
=
(
permissions
.
FullAnonAccess
,
)
"""
"""
List of all permissions that must be checked.
List of all permissions that must be checked.
"""
"""
...
@@ -240,18 +239,21 @@ class ModelView(View):
...
@@ -240,18 +239,21 @@ class ModelView(View):
"""
"""
resource
=
resources
.
ModelResource
resource
=
resources
.
ModelResource
class
InstanceModelView
(
InstanceMixin
,
ReadModelMixin
,
UpdateModelMixin
,
DeleteModelMixin
,
ModelView
):
class
InstanceModelView
(
InstanceMixin
,
ReadModelMixin
,
UpdateModelMixin
,
DeleteModelMixin
,
ModelView
):
"""
"""
A view which provides default operations for read/update/delete against a model instance.
A view which provides default operations for read/update/delete against a model instance.
"""
"""
_suffix
=
'Instance'
_suffix
=
'Instance'
class
ListModelView
(
ListModelMixin
,
ModelView
):
class
ListModelView
(
ListModelMixin
,
ModelView
):
"""
"""
A view which provides default operations for list, against a model in the database.
A view which provides default operations for list, against a model in the database.
"""
"""
_suffix
=
'List'
_suffix
=
'List'
class
ListOrCreateModelView
(
ListModelMixin
,
CreateModelMixin
,
ModelView
):
class
ListOrCreateModelView
(
ListModelMixin
,
CreateModelMixin
,
ModelView
):
"""
"""
A view which provides default operations for list and create, against a model in the database.
A view which provides default operations for list and create, against a model in the database.
...
...
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