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
714a90d7
Commit
714a90d7
authored
Jan 24, 2012
by
Sébastien Piquemal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation for request module
parent
8b72b7bf
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
10 deletions
+21
-10
djangorestframework/mixins.py
+4
-4
djangorestframework/request.py
+12
-6
docs/library/request.rst
+5
-0
No files found.
djangorestframework/mixins.py
View file @
714a90d7
...
@@ -40,7 +40,7 @@ __all__ = (
...
@@ -40,7 +40,7 @@ __all__ = (
class
RequestMixin
(
object
):
class
RequestMixin
(
object
):
"""
"""
`Mixin` class to
provide request parsing behavior
.
`Mixin` class to
enhance API of Django's standard `request`
.
"""
"""
_USE_FORM_OVERLOADING
=
True
_USE_FORM_OVERLOADING
=
True
...
@@ -50,15 +50,15 @@ class RequestMixin(object):
...
@@ -50,15 +50,15 @@ class RequestMixin(object):
parsers
=
()
parsers
=
()
"""
"""
The set of
request parsers that the view
can handle.
The set of
parsers that the request
can handle.
Should be a tuple/list of classes as described in the :mod:`parsers` module.
Should be a tuple/list of classes as described in the :mod:`parsers` module.
"""
"""
def
get_request_class
(
self
):
def
get_request_class
(
self
):
"""
"""
Returns a
custom subclass of Django's `HttpRequest`, providing new facilities
Returns a
subclass of Django's `HttpRequest` with a richer API,
such as direct access to the parsed request content
.
as described in :mod:`request`
.
"""
"""
if
not
hasattr
(
self
,
'_request_class'
):
if
not
hasattr
(
self
,
'_request_class'
):
self
.
_request_class
=
request_class_factory
(
self
.
request
)
self
.
_request_class
=
request_class_factory
(
self
.
request
)
...
...
djangorestframework/request.py
View file @
714a90d7
"""
"""
The :mod:`request` module provides a `Request` class that can be used
The :mod:`request` module provides a :class:`Request` class that can be used
to replace the standard Django request passed to the views.
to enhance the standard `request` object received in all the views.
This replacement `Request` provides many facilities, like automatically
parsed request content, form overloading of method/content type/content,
This enhanced request object offers the following :
better support for HTTP PUT method.
- content automatically parsed according to `Content-Type` header, and available as :meth:`request.DATA<Request.DATA>`
- full support of PUT method, including support for file uploads
- form overloading of HTTP method, content type and content
"""
"""
from
django.http
import
HttpRequest
from
django.http
import
HttpRequest
...
@@ -14,7 +17,7 @@ from djangorestframework.utils import as_tuple
...
@@ -14,7 +17,7 @@ from djangorestframework.utils import as_tuple
from
StringIO
import
StringIO
from
StringIO
import
StringIO
__all__
=
(
'Request'
)
__all__
=
(
'Request'
,
)
def
request_class_factory
(
request
):
def
request_class_factory
(
request
):
...
@@ -30,6 +33,9 @@ def request_class_factory(request):
...
@@ -30,6 +33,9 @@ def request_class_factory(request):
class
Request
(
object
):
class
Request
(
object
):
"""
A mixin class allowing to enhance Django's standard HttpRequest.
"""
_USE_FORM_OVERLOADING
=
True
_USE_FORM_OVERLOADING
=
True
_METHOD_PARAM
=
'_method'
_METHOD_PARAM
=
'_method'
...
...
docs/library/request.rst
0 → 100644
View file @
714a90d7
:mod:`request`
=====================
.. automodule:: request
:members:
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