diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 20:10:28 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 20:10:28 -0400 |
commit | fdaa35a9386ccb8adab23f46d9260f8ed407bf5c (patch) | |
tree | c515ad832889f513252706e073173bc63601a81b /todolists | |
parent | acc68977135b880b28f2aa83b6938eae46467195 (diff) |
refactor todo packages a bit
Diffstat (limited to 'todolists')
-rw-r--r-- | todolists/views.py | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/todolists/views.py b/todolists/views.py index d76c24b3..dc1a9aa7 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -41,11 +41,10 @@ def flag(request, listid, pkgid): def view(request, listid): list = get_object_or_404(Todolist, id=listid) - pkgs = TodolistPkg.objects.filter(list=list.id).order_by('pkg') return render_response( request, 'todolists/view.html', - {'list':list,'pkgs':pkgs}) + {'list':list}) def list(request): lists = Todolist.objects.order_by('-date_added') @@ -57,18 +56,14 @@ def list(request): @permission_required('todolists.add_todolist') def add(request): if request.POST: - # create the list form = TodoListForm(request.POST) if form.is_valid(): - todo = Todolist( + todo = Todolist.objects.create( creator = request.user, name = form.clean_data['name'], description = form.clean_data['description']) - todo.save() - # now link in packages for pkg in form.clean_data['packages']: - todopkg = TodolistPkg(list = todo, pkg = pkg) - todopkg.save() + TodolistPkg.objects.create(list = todo, pkg = pkg) return HttpResponseRedirect('/todo/') else: form = TodoListForm() |