mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Set proper status code in AdminRenderer for the redirection after POST/DELETE requests. (#4106)
This commit is contained in:
		
							parent
							
								
									788603e153
								
							
						
					
					
						commit
						1328982de3
					
				| 
						 | 
					@ -712,12 +712,12 @@ class AdminRenderer(BrowsableAPIRenderer):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Creation and deletion should use redirects in the admin style.
 | 
					        # Creation and deletion should use redirects in the admin style.
 | 
				
			||||||
        if (response.status_code == status.HTTP_201_CREATED) and ('Location' in response):
 | 
					        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()
 | 
					            response['Location'] = request.build_absolute_uri()
 | 
				
			||||||
            ret = ''
 | 
					            ret = ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if response.status_code == status.HTTP_204_NO_CONTENT:
 | 
					        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:
 | 
					            try:
 | 
				
			||||||
                # Attempt to get the parent breadcrumb URL.
 | 
					                # Attempt to get the parent breadcrumb URL.
 | 
				
			||||||
                response['Location'] = self.get_breadcrumbs(request)[-2][1]
 | 
					                response['Location'] = self.get_breadcrumbs(request)[-2][1]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user