mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
polishing code
and adding myself to auhtors file
This commit is contained in:
parent
3a30a9b1cb
commit
8b999c6bb5
|
@ -59,6 +59,7 @@ The following people have helped make REST framework great.
|
|||
* Toni Michel - [tonimichel]
|
||||
* Ben Konrath - [benkonrath]
|
||||
* Marc Aymerich - [glic3rinu]
|
||||
* Ludwig Kraatz - [ludwigkraatz]
|
||||
|
||||
Many thanks to everyone who's contributed to the project.
|
||||
|
||||
|
@ -153,3 +154,4 @@ To contact the author directly:
|
|||
[tonimichel]: https://github.com/tonimichel
|
||||
[benkonrath]: https://github.com/benkonrath
|
||||
[glic3rinu]: https://github.com/glic3rinu
|
||||
[ludwigkraatz]: https://github.com/ludwigkraatz
|
||||
|
|
|
@ -24,8 +24,8 @@ class CreateModelMixin(object):
|
|||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def get_success_headers(self,data):
|
||||
if "url" in data:
|
||||
return {'Location':data.get("url")}
|
||||
if 'url' in data:
|
||||
return {'Location': data.get('url')}
|
||||
else:
|
||||
return {}
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ class TestCreateWithForeignKeys(TestCase):
|
|||
request = factory.post('/comments/', data=data)
|
||||
response = self.create_view(request).render()
|
||||
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.all()[0].text, 'A test comment')
|
||||
|
||||
|
@ -221,7 +221,7 @@ class TestCreateWithForeignKeysAndCustomSlug(TestCase):
|
|||
request = factory.post('/photos/', data=data)
|
||||
response = self.list_create_view(request).render()
|
||||
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.all()[0].description, 'A test photo')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user