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
06b28f66
Commit
06b28f66
authored
May 22, 2013
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak method ordering for better consistency
parent
0e80a535
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
rest_framework/mixins.py
+10
-10
No files found.
rest_framework/mixins.py
View file @
06b28f66
...
@@ -110,16 +110,6 @@ class UpdateModelMixin(object):
...
@@ -110,16 +110,6 @@ class UpdateModelMixin(object):
"""
"""
Update a model instance.
Update a model instance.
"""
"""
def
get_object_or_none
(
self
):
try
:
return
self
.
get_object
()
except
Http404
:
# If this is a PUT-as-create operation, we need to ensure that
# we have relevant permissions, as if this was a POST request.
# This will either raise a PermissionDenied exception,
# or simply return None
self
.
check_permissions
(
clone_request
(
self
.
request
,
'POST'
))
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
partial
=
kwargs
.
pop
(
'partial'
,
False
)
partial
=
kwargs
.
pop
(
'partial'
,
False
)
self
.
object
=
self
.
get_object_or_none
()
self
.
object
=
self
.
get_object_or_none
()
...
@@ -148,6 +138,16 @@ class UpdateModelMixin(object):
...
@@ -148,6 +138,16 @@ class UpdateModelMixin(object):
kwargs
[
'partial'
]
=
True
kwargs
[
'partial'
]
=
True
return
self
.
update
(
request
,
*
args
,
**
kwargs
)
return
self
.
update
(
request
,
*
args
,
**
kwargs
)
def
get_object_or_none
(
self
):
try
:
return
self
.
get_object
()
except
Http404
:
# If this is a PUT-as-create operation, we need to ensure that
# we have relevant permissions, as if this was a POST request.
# This will either raise a PermissionDenied exception,
# or simply return None
self
.
check_permissions
(
clone_request
(
self
.
request
,
'POST'
))
def
pre_save
(
self
,
obj
):
def
pre_save
(
self
,
obj
):
"""
"""
Set any attributes on the object that are implicit in the request.
Set any attributes on the object that are implicit in the request.
...
...
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