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
b54cbd29
Commit
b54cbd29
authored
Aug 27, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use view.settings for API settings, to make testing easier.
parent
b430503f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
rest_framework/views.py
+6
-3
No files found.
rest_framework/views.py
View file @
b54cbd29
...
@@ -79,8 +79,8 @@ def exception_handler(exc):
...
@@ -79,8 +79,8 @@ def exception_handler(exc):
class
APIView
(
View
):
class
APIView
(
View
):
settings
=
api_settings
# The following policies may be set at either globally, or per-view.
renderer_classes
=
api_settings
.
DEFAULT_RENDERER_CLASSES
renderer_classes
=
api_settings
.
DEFAULT_RENDERER_CLASSES
parser_classes
=
api_settings
.
DEFAULT_PARSER_CLASSES
parser_classes
=
api_settings
.
DEFAULT_PARSER_CLASSES
authentication_classes
=
api_settings
.
DEFAULT_AUTHENTICATION_CLASSES
authentication_classes
=
api_settings
.
DEFAULT_AUTHENTICATION_CLASSES
...
@@ -88,6 +88,9 @@ class APIView(View):
...
@@ -88,6 +88,9 @@ class APIView(View):
permission_classes
=
api_settings
.
DEFAULT_PERMISSION_CLASSES
permission_classes
=
api_settings
.
DEFAULT_PERMISSION_CLASSES
content_negotiation_class
=
api_settings
.
DEFAULT_CONTENT_NEGOTIATION_CLASS
content_negotiation_class
=
api_settings
.
DEFAULT_CONTENT_NEGOTIATION_CLASS
# Allow dependancy injection of other settings to make testing easier.
settings
=
api_settings
@classmethod
@classmethod
def
as_view
(
cls
,
**
initkwargs
):
def
as_view
(
cls
,
**
initkwargs
):
"""
"""
...
@@ -178,7 +181,7 @@ class APIView(View):
...
@@ -178,7 +181,7 @@ class APIView(View):
Return the view name, as used in OPTIONS responses and in the
Return the view name, as used in OPTIONS responses and in the
browsable API.
browsable API.
"""
"""
func
=
api_
settings
.
VIEW_NAME_FUNCTION
func
=
self
.
settings
.
VIEW_NAME_FUNCTION
return
func
(
self
.
__class__
,
getattr
(
self
,
'suffix'
,
None
))
return
func
(
self
.
__class__
,
getattr
(
self
,
'suffix'
,
None
))
def
get_view_description
(
self
,
html
=
False
):
def
get_view_description
(
self
,
html
=
False
):
...
@@ -186,7 +189,7 @@ class APIView(View):
...
@@ -186,7 +189,7 @@ class APIView(View):
Return some descriptive text for the view, as used in OPTIONS responses
Return some descriptive text for the view, as used in OPTIONS responses
and in the browsable API.
and in the browsable API.
"""
"""
func
=
api_
settings
.
VIEW_DESCRIPTION_FUNCTION
func
=
self
.
settings
.
VIEW_DESCRIPTION_FUNCTION
return
func
(
self
.
__class__
,
html
)
return
func
(
self
.
__class__
,
html
)
# API policy instantiation methods
# API policy instantiation methods
...
...
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