{"id":5993,"date":"2022-12-01T06:35:12","date_gmt":"2022-12-01T06:35:12","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=5993"},"modified":"2022-12-03T08:23:36","modified_gmt":"2022-12-03T08:23:36","slug":"django-deleteview","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/django-tutorial\/django-deleteview\/","title":{"rendered":"Django DeleteView"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to use the Django <code>DeleteView<\/code> class to define a class-based view that deletes an existing object.<\/p>\n\n\n\n<p class=\"note\">This tutorial begins where\u00a0the\u00a0<a href=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-updateview\/\">Django UpdateView tutorial<\/a>\u00a0left off.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='create-a-django-deleteview-class'>Create a Django DeleteView class <a href=\"#create-a-django-deleteview-class\" class=\"anchor\" id=\"create-a-django-deleteview-class\" title=\"Anchor for Create a Django DeleteView class\">#<\/a><\/h2>\n\n\n\n<p>The Django <code>DeleteView<\/code> class allows you to define a class-based view that displays a confirmation page and deletes an existing object.<\/p>\n\n\n\n<p>If the HTTP request method is <code>GET<\/code>, the <code><code>DeleteView<\/code><\/code> view will display the confirmation page. However, if the request is <code>POST<\/code>, the <code><code>DeleteView<\/code><\/code> view will delete the object.<\/p>\n\n\n\n<p>To use the <code>DeleteView<\/code> class, you <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-inheritance\/\">define a class that inherits<\/a> from it and add <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-class-attributes\/\">attributes<\/a> and <a href=\"https:\/\/www.pythontutorial.net\/python-oop\/python-methods\/\">methods<\/a> to override the default behaviors.<\/p>\n\n\n\n<p>For example, the following defines a <code>TaskDelete<\/code> class that deletes a task for the <a href=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-todo-app\/\">Todo app<\/a>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-comment\">#...<\/span>\n<span class=\"hljs-keyword\">from<\/span> django.views.generic.edit <span class=\"hljs-keyword\">import<\/span> DeleteView, CreateView, UpdateView\n<span class=\"hljs-keyword\">from<\/span> django.contrib <span class=\"hljs-keyword\">import<\/span> messages\n<span class=\"hljs-keyword\">from<\/span> django.urls <span class=\"hljs-keyword\">import<\/span> reverse_lazy\n\n<span class=\"hljs-keyword\">from<\/span> .models <span class=\"hljs-keyword\">import<\/span> Task\n\n<span class=\"hljs-class\"><span class=\"hljs-keyword\">class<\/span> <span class=\"hljs-title\">TaskDelete<\/span><span class=\"hljs-params\">(DeleteView)<\/span>:<\/span>\n    model = Task\n    context_object_name = <span class=\"hljs-string\">'task'<\/span>\n    success_url = reverse_lazy(<span class=\"hljs-string\">'tasks'<\/span>)\n    \n    <span class=\"hljs-function\"><span class=\"hljs-keyword\">def<\/span> <span class=\"hljs-title\">form_valid<\/span><span class=\"hljs-params\">(self, form)<\/span>:<\/span>\n        messages.success(self.request, <span class=\"hljs-string\">\"The task was deleted successfully.\"<\/span>)\n        <span class=\"hljs-keyword\">return<\/span> super(TaskDelete,self).form_valid(form)\n\n<span class=\"hljs-comment\">#...<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this example, we define the <code><code>TaskDelete<\/code><\/code> class that is a subclass of the <code>DeleteView<\/code> class. The <code><code>TaskDelete<\/code><\/code> class has the following attributes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>model<\/code> specifies the class of the model (<code>Task<\/code>) that will be deleted.<\/li>\n\n\n\n<li><code><code>context_object_name<\/code><\/code> specifies the object name that will be passed to the template. By default, the <code>DeleteView<\/code> class uses the <code>object<\/code> as the name. However, you can override the name using the <code><code>context_object_name<\/code><\/code> attribute.<\/li>\n\n\n\n<li><code>success_url<\/code> is the URL that will be redirected to once the object is deleted successfully.<\/li>\n\n\n\n<li><code><code>form_valid()<\/code><\/code> method is called once the object is deleted successfully. In this example, we create a flash message.<\/li>\n<\/ul>\n\n\n\n<p>By default, the <code>DeleteView<\/code> class uses the <code>task_confirmation_delete.html<\/code> template if you don&#8217;t specify it explicitly.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='creating-task_confirm_delete-html-template'>Creating task_confirm_delete.html template <a href=\"#creating-task_confirm_delete-html-template\" class=\"anchor\" id=\"creating-task_confirm_delete-html-template\" title=\"Anchor for Creating task_confirm_delete.html template\">#<\/a><\/h2>\n\n\n\n<p>Create a new file <code>task_confirm_delete.html<\/code> template in the <code>templates\/todo<\/code> app with the following code:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">{%extends 'base.html'%}\n\n{%block content%}\n<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"center\"<\/span>&gt;<\/span>\n\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">form<\/span> <span class=\"hljs-attr\">method<\/span>=<span class=\"hljs-string\">\"post\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"card\"<\/span>&gt;<\/span>\n\t\t{% csrf_token %}\n\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2<\/span>&gt;<\/span>Delete Task<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h2<\/span>&gt;<\/span>\n\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p<\/span>&gt;<\/span>Are you sure that you want to delete \"{{task}}\"?<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">p<\/span>&gt;<\/span>\n\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"form-buttons\"<\/span>&gt;<\/span>\n\t\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">input<\/span> <span class=\"hljs-attr\">type<\/span>=<span class=\"hljs-string\">\"submit\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"btn btn-primary\"<\/span> <span class=\"hljs-attr\">value<\/span>=<span class=\"hljs-string\">\"Delete\"<\/span>&gt;<\/span>\n\t\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\">\"{% url 'tasks'%}\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"btn btn-outline\"<\/span>&gt;<\/span>Cancel<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">a<\/span>&gt;<\/span>\n\t\t<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">p<\/span>&gt;<\/span>\n\t<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">form<\/span>&gt;<\/span>\n<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n\n{%endblock content%}<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>The <code>task_confirm_delete.html<\/code> extends the <code>base.html<\/code> template and contains a form that deletes a task.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='defining-a-route'>Defining a route <a href=\"#defining-a-route\" class=\"anchor\" id=\"defining-a-route\" title=\"Anchor for Defining a route\">#<\/a><\/h2>\n\n\n\n<p>Define a new route in the <code>urls.py<\/code> that maps a URL that deletes a task with the result of the <code>as_view()<\/code> method of the <code>TaskDelete<\/code> view class:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Python\" data-shcb-language-slug=\"python\"><span><code class=\"hljs language-python\"><span class=\"hljs-keyword\">from<\/span> django.urls <span class=\"hljs-keyword\">import<\/span> path\n<span class=\"hljs-keyword\">from<\/span> .views <span class=\"hljs-keyword\">import<\/span> (\n    home, \n    TaskList, \n    TaskDetail, \n    TaskCreate, \n    TaskUpdate,\n    TaskDelete\n)\n\n\nurlpatterns = &#91;\n    path(<span class=\"hljs-string\">''<\/span>, home, name=<span class=\"hljs-string\">'home'<\/span>),\n    path(<span class=\"hljs-string\">'tasks\/'<\/span>, TaskList.as_view(),name=<span class=\"hljs-string\">'tasks'<\/span>),\n    path(<span class=\"hljs-string\">'task\/&lt;int:pk&gt;\/'<\/span>, TaskDetail.as_view(),name=<span class=\"hljs-string\">'task'<\/span>),\n    path(<span class=\"hljs-string\">'task\/create\/'<\/span>, TaskCreate.as_view(),name=<span class=\"hljs-string\">'task-create'<\/span>),\n    path(<span class=\"hljs-string\">'task\/update\/&lt;int:pk&gt;\/'<\/span>, TaskUpdate.as_view(),name=<span class=\"hljs-string\">'task-update'<\/span>),\n    path(<span class=\"hljs-string\">'task\/delete\/&lt;int:pk&gt;\/'<\/span>, TaskDelete.as_view(),name=<span class=\"hljs-string\">'task-delete'<\/span>),\n]<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Python<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">python<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='including-a-link-to-delete-a-task'>Including a link to delete a task <a href=\"#including-a-link-to-delete-a-task\" class=\"anchor\" id=\"including-a-link-to-delete-a-task\" title=\"Anchor for Including a link to delete a task\">#<\/a><\/h2>\n\n\n\n<p>Modify the <code>task_list.html<\/code> template to add a link that deletes a task to each task on the task list:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml shcb-code-table\"><span class='shcb-loc'><span>{%extends 'base.html'%}\n<\/span><\/span><span class='shcb-loc'><span>\n<\/span><\/span><span class='shcb-loc'><span>{%block content%}\n<\/span><\/span><span class='shcb-loc'><span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"center\"<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">h2<\/span>&gt;<\/span>My Todo List<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">h2<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t{% if tasks %}\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">ul<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"tasks\"<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t\t{% for task in tasks %}\n<\/span><\/span><span class='shcb-loc'><span>\t\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">li<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\">\"{% url 'task' task.id %}\"<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"{% if task.completed%}completed{%endif%}\"<\/span>&gt;<\/span>{{ task.title }}<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">a<\/span>&gt;<\/span> \n<\/span><\/span><span class='shcb-loc'><span>\t\t\t\t <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">div<\/span>  <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"task-controls\"<\/span>&gt;<\/span>\n<\/span><\/span><mark class='shcb-loc'><span>\t\t\t\t \t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\">\"{%url 'task-delete' task.id %}\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">i<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"bi bi-trash\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">i<\/span>&gt;<\/span> <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">a<\/span>&gt;<\/span>\n<\/span><\/mark><span class='shcb-loc'><span>\t\t\t\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\">\"{%url 'task-update' task.id %}\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">i<\/span> <span class=\"hljs-attr\">class<\/span>=<span class=\"hljs-string\">\"bi bi-pencil-square\"<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">i<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">a<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t\t         <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t\t    <span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">li<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t\t{% endfor %}\n<\/span><\/span><span class='shcb-loc'><span>\t{% else %}\n<\/span><\/span><span class='shcb-loc'><span>\t\t<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">p<\/span>&gt;<\/span>? Yay, you have no pending tasks! <span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">a<\/span> <span class=\"hljs-attr\">href<\/span>=<span class=\"hljs-string\">\"{%url 'task-create'%}\"<\/span>&gt;<\/span>Create Task<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">a<\/span>&gt;<\/span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">p<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>\t{% endif %}\n<\/span><\/span><span class='shcb-loc'><span>\t<span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">ul<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span><span class=\"hljs-tag\">&lt;\/<span class=\"hljs-name\">div<\/span>&gt;<\/span>\n<\/span><\/span><span class='shcb-loc'><span>{%endblock content%}\n<\/span><\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>If you click the delete button to delete a task on the list, you&#8217;ll get the following delete confirmation page:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"217\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView.png\" alt=\"\" class=\"wp-image-5996\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView.png 512w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView-300x127.png 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n\n\n\n<p>Click the Delete button will delete the task from the database and redirect it back to the task list:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"213\" src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView-example.png\" alt=\"django todo list - DeleteView example\" class=\"wp-image-5997\" srcset=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView-example.png 581w, https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/django-todo-list-DeleteView-example-300x110.png 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"592\" style=\"aspect-ratio: 714 \/ 592;\" width=\"714\" controls src=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/Django-DeleteView-Demo.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"note\">You can download the final code for this <a href=\"https:\/\/www.pythontutorial.net\/wp-content\/uploads\/2022\/12\/todo_list_6_delete_view.zip\">Django DeleteView tutorial<\/a> here.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='summary'>Summary <a href=\"#summary\" class=\"anchor\" id=\"summary\" title=\"Anchor for Summary\">#<\/a><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use Django <code>DeleteView<\/code> class to define a class-based view that deletes an existing object.<\/li>\n<\/ul>\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"5993\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-deleteview\/\"\n\t\t\t\tdata-post-title=\"Django DeleteView\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"5993\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/django-tutorial\/django-deleteview\/\"\n\t\t\t\tdata-post-title=\"Django DeleteView\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to use the Django DeleteView class to define a class-based view that deletes an existing object.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":5531,"menu_order":17,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5993","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=5993"}],"version-history":[{"count":0,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5993\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/5531"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=5993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}