summaryrefslogtreecommitdiff
path: root/todolists/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-10-04 16:35:31 -0500
committerDan McGee <dan@archlinux.org>2010-10-04 16:35:31 -0500
commit0e58a2e49f59fe41a27afa7bf8f9b3c77405c6d1 (patch)
tree9943d4c2984b2e18586cb8fd530bbe733ec81b72 /todolists/views.py
parent5e509529f00bd50ddfc6638d92c601209664d5d8 (diff)
Todo list minor fixes and comments for later
When we show the edit todo list page, use a sorted list retrieved straight from the database instead of a unordered set() we create at the application level. Also add some comments for potential later improvements on transaction boundaries and async emailing. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'todolists/views.py')
-rw-r--r--todolists/views.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/todolists/views.py b/todolists/views.py
index 25186243..519fae9d 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -68,6 +68,7 @@ def list(request):
return direct_to_template(request, 'todolists/list.html', {'lists': lists})
+# TODO: this calls for transaction management and async emailing
@permission_required('main.add_todolist')
@never_cache
def add(request):
@@ -80,7 +81,7 @@ def add(request):
description = form.cleaned_data['description'])
for pkg in form.cleaned_data['packages']:
- tpkg = TodolistPkg.objects.create(list = todo, pkg = pkg)
+ tpkg = TodolistPkg.objects.create(list=todo, pkg=pkg)
send_todolist_email(tpkg)
return redirect('/todo/')
@@ -91,9 +92,10 @@ def add(request):
'title': 'Add Todo List',
'form': form,
'submit_text': 'Create List'
- }
+ }
return direct_to_template(request, 'general_form.html', page_dict)
+# TODO: this calls for transaction management and async emailing
@permission_required('main.change_todolist')
@never_cache
def edit(request, list_id):
@@ -116,7 +118,7 @@ def edit(request, list_id):
for pkg in form.cleaned_data['packages']:
if pkg not in packages:
tpkg = TodolistPkg.objects.create(
- list = todo_list, pkg = pkg)
+ list=todo_list, pkg=pkg)
send_todolist_email(tpkg)
return redirect(todo_list)
@@ -124,13 +126,13 @@ def edit(request, list_id):
form = TodoListForm(initial={
'name': todo_list.name,
'description': todo_list.description,
- 'packages': todo_list.package_names,
- })
+ 'packages': '\n'.join(todo_list.package_names),
+ })
page_dict = {
'title': 'Edit Todo List: %s' % todo_list.name,
'form': form,
'submit_text': 'Save List'
- }
+ }
return direct_to_template(request, 'general_form.html', page_dict)
@permission_required('main.delete_todolist')