Fakultas Ilmu Komputer UI

Commit b4bca2c0 authored by Muhammad Ilham Peruzzi's avatar Muhammad Ilham Peruzzi
Browse files

create business logic to delete selected todo

parent d37a4134
......@@ -28,4 +28,10 @@ def new_list(request):
def add_item(request, list_id):
list_ = List.objects.get(id=list_id)
Item.objects.create(text=request.POST['item_text'], list=list_)
return redirect('/lists/%d/' % (list_.id,))
def delete_todo(request, list_id, id):
list_ = List.objects.get(id=list_id)
instance = Item.objects.get(id=id)
instance.delete()
return redirect('/lists/%d/' % (list_.id,))
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment