def delete(self, request, *args, **kwargs):
self.object = self.get_object()<EOL>self.pre_delete()<EOL>self.object.delete()<EOL>self.post_delete()<EOL>if self.request.is_ajax():<EOL><INDENT>return self.render_json_response(self.get_success_result())<EOL><DEDENT>success_url = self.get_success_url()<EOL>return HttpResponseRedirect(success_url)<EOL>
The same logic as in DeleteView but some hooks and
JSON response in case of AJAX request