Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set proper status code in AdminRenderer for the redirection after POS…
…T/DELETE requests.
  • Loading branch information
Alexander Gaevsky committed May 8, 2016
commit 4102cbfb40e980668d7db2a8ac18a1e7c97fe344
4 changes: 2 additions & 2 deletions rest_framework/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,12 +712,12 @@ def render(self, data, accepted_media_type=None, renderer_context=None):

# Creation and deletion should use redirects in the admin style.
if (response.status_code == status.HTTP_201_CREATED) and ('Location' in response):
response.status_code = status.HTTP_302_FOUND
response.status_code = status.HTTP_303_SEE_OTHER
response['Location'] = request.build_absolute_uri()
ret = ''

if response.status_code == status.HTTP_204_NO_CONTENT:
response.status_code = status.HTTP_302_FOUND
response.status_code = status.HTTP_303_SEE_OTHER
try:
# Attempt to get the parent breadcrumb URL.
response['Location'] = self.get_breadcrumbs(request)[-2][1]
Expand Down