From d241ae78eec85f4667fb24721ca027743c814df3 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Sun, 29 Jun 2008 19:17:20 -0400 Subject: fix problem with deleting packages from a list --- todolists/views.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/todolists/views.py b/todolists/views.py index 52987356..2931d9bb 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -86,6 +86,12 @@ def edit(request, list_id): packages = [p.pkg for p in todo_list.packages] + # first delete any packages not in the new list + for p in todo_list.packages: + if p.pkg not in form.clean_data['packages']: + p.delete() + + # now add any packages not in the old list for pkg in form.clean_data['packages']: if pkg not in packages: TodolistPkg.objects.create(list = todo_list, pkg = pkg) -- cgit v1.2.3-54-g00ecf