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
8b999c6b
Commit
8b999c6b
authored
Nov 14, 2012
by
Ludwig Kraatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polishing code
and adding myself to auhtors file
parent
3a30a9b1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
docs/topics/credits.md
+2
-0
rest_framework/mixins.py
+2
-2
rest_framework/tests/hyperlinkedserializers.py
+2
-2
No files found.
docs/topics/credits.md
View file @
8b999c6b
...
@@ -59,6 +59,7 @@ The following people have helped make REST framework great.
...
@@ -59,6 +59,7 @@ The following people have helped make REST framework great.
*
Toni Michel -
[
tonimichel
]
*
Toni Michel -
[
tonimichel
]
*
Ben Konrath -
[
benkonrath
]
*
Ben Konrath -
[
benkonrath
]
*
Marc Aymerich -
[
glic3rinu
]
*
Marc Aymerich -
[
glic3rinu
]
*
Ludwig Kraatz -
[
ludwigkraatz
]
Many thanks to everyone who's contributed to the project.
Many thanks to everyone who's contributed to the project.
...
@@ -153,3 +154,4 @@ To contact the author directly:
...
@@ -153,3 +154,4 @@ To contact the author directly:
[
tonimichel
]:
https://github.com/tonimichel
[
tonimichel
]:
https://github.com/tonimichel
[
benkonrath
]:
https://github.com/benkonrath
[
benkonrath
]:
https://github.com/benkonrath
[
glic3rinu
]:
https://github.com/glic3rinu
[
glic3rinu
]:
https://github.com/glic3rinu
[
ludwigkraatz
]:
https://github.com/ludwigkraatz
rest_framework/mixins.py
View file @
8b999c6b
...
@@ -24,8 +24,8 @@ class CreateModelMixin(object):
...
@@ -24,8 +24,8 @@ class CreateModelMixin(object):
return
Response
(
serializer
.
errors
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
return
Response
(
serializer
.
errors
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
def
get_success_headers
(
self
,
data
):
def
get_success_headers
(
self
,
data
):
if
"url"
in
data
:
if
'url'
in
data
:
return
{
'Location'
:
data
.
get
(
"url"
)}
return
{
'Location'
:
data
.
get
(
'url'
)}
else
:
else
:
return
{}
return
{}
...
...
rest_framework/tests/hyperlinkedserializers.py
View file @
8b999c6b
...
@@ -196,7 +196,7 @@ class TestCreateWithForeignKeys(TestCase):
...
@@ -196,7 +196,7 @@ class TestCreateWithForeignKeys(TestCase):
request
=
factory
.
post
(
'/comments/'
,
data
=
data
)
request
=
factory
.
post
(
'/comments/'
,
data
=
data
)
response
=
self
.
create_view
(
request
)
.
render
()
response
=
self
.
create_view
(
request
)
.
render
()
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertEqual
(
response
[
"Location"
],
'http://testserver/comments/1/'
)
self
.
assertEqual
(
response
[
'Location'
],
'http://testserver/comments/1/'
)
self
.
assertEqual
(
self
.
post
.
blogpostcomment_set
.
count
(),
1
)
self
.
assertEqual
(
self
.
post
.
blogpostcomment_set
.
count
(),
1
)
self
.
assertEqual
(
self
.
post
.
blogpostcomment_set
.
all
()[
0
]
.
text
,
'A test comment'
)
self
.
assertEqual
(
self
.
post
.
blogpostcomment_set
.
all
()[
0
]
.
text
,
'A test comment'
)
...
@@ -221,7 +221,7 @@ class TestCreateWithForeignKeysAndCustomSlug(TestCase):
...
@@ -221,7 +221,7 @@ class TestCreateWithForeignKeysAndCustomSlug(TestCase):
request
=
factory
.
post
(
'/photos/'
,
data
=
data
)
request
=
factory
.
post
(
'/photos/'
,
data
=
data
)
response
=
self
.
list_create_view
(
request
)
.
render
()
response
=
self
.
list_create_view
(
request
)
.
render
()
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
self
.
assertNotIn
(
"Location"
,
response
,
msg
=
"Location should only be included if there is a 'url' field on the serializer"
)
self
.
assertNotIn
(
'Location'
,
response
,
msg
=
'Location should only be included if there is a "url" field on the serializer'
)
self
.
assertEqual
(
self
.
post
.
photo_set
.
count
(),
1
)
self
.
assertEqual
(
self
.
post
.
photo_set
.
count
(),
1
)
self
.
assertEqual
(
self
.
post
.
photo_set
.
all
()[
0
]
.
description
,
'A test photo'
)
self
.
assertEqual
(
self
.
post
.
photo_set
.
all
()[
0
]
.
description
,
'A test photo'
)
...
...
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