From 2fe6c1e84f8e3759e7c9cab27838156e591e2251 Mon Sep 17 00:00:00 2001 From: Amirhossein Vejahat Date: Tue, 24 Mar 2020 15:07:54 +0430 Subject: [PATCH] multiple delete to delete the items you should get the item id(s) as a list --- todolist/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/todolist/views.py b/todolist/views.py index 14d113b..6ad011c 100644 --- a/todolist/views.py +++ b/todolist/views.py @@ -20,7 +20,7 @@ def index(request): #the index view return redirect("/") #reloading the page if "taskDelete" in request.POST: #checking if there is a request to delete a todo - checkedlist = request.POST["checkedbox"] #checked todos to be deleted + checkedlist = request.POST.getlist("checkedbox") #checked todos to be deleted for todo_id in checkedlist: todo = TodoList.objects.get(id=int(todo_id)) #getting todo id todo.delete() #deleting todo