diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-06-29 19:17:20 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-06-29 19:17:20 -0400 |
commit | d241ae78eec85f4667fb24721ca027743c814df3 (patch) | |
tree | bdd82e808fbcf877d99b288add8fef5dbedbf3ec | |
parent | 74372354604d1d12412c12d2e89dcd51ec6250b9 (diff) |
fix problem with deleting packages from a list
-rw-r--r-- | todolists/views.py | 6 |
1 files changed, 6 insertions, 0 deletions
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) |