def delete(self, request, pk): """ Delete an xsl document Args: request: HTTP request pk: ObjectId Returns: - code: 204 content: Deletion succeed - code: 404 content: Object was not found - code: 500 content: Internal server error """ try: # Get object xsl_object = self.get_object(pk) # Remove the instance xsl_api.delete(xsl_object) # Return response return Response(status=status.HTTP_204_NO_CONTENT) except Http404: content = {'message': 'Xsl not found.'} return Response(content, status=status.HTTP_404_NOT_FOUND) except Exception as api_exception: content = {'message': api_exception.message} return Response(content, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def delete(self, request, pk): """ Delete xsl document by its id. DELETE /rest/xslt/pk Args: pk: Returns: """ try: # Get object xsl_object = self.get_object(pk) # Remove the instance xsl_api.delete(xsl_object) # Return response return Response(status=status.HTTP_204_NO_CONTENT) except Http404: content = {'message': 'Xsl not found.'} return Response(content, status=status.HTTP_404_NOT_FOUND) except Exception as api_exception: content = {'message': api_exception.message} return Response(content, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
def _delete(self, request, *args, **kwargs): # Delete treatment. xsl_transformation_api.delete(self.object)