summaryrefslogtreecommitdiff
path: root/todolists/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-03-29 16:15:28 -0500
committerDan McGee <dan@archlinux.org>2011-04-07 17:03:33 -0500
commitd456ff32aa3255113eab9e9c83676660807514e8 (patch)
tree0bd606f768a5192a98c52a6b46fec82bb9fe5f75 /todolists/views.py
parentb2f7cd61e89c59bb52a542f6667aabd53743681c (diff)
Convert todolist delete to class-based view
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'todolists/views.py')
-rw-r--r--todolists/views.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/todolists/views.py b/todolists/views.py
index 6bd456ae..a2029be0 100644
--- a/todolists/views.py
+++ b/todolists/views.py
@@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required, permission_required
from django.db import transaction
from django.db.models import Count
from django.views.decorators.cache import never_cache
-from django.views.generic.create_update import delete_object
+from django.views.generic import DeleteView
from django.views.generic.simple import direct_to_template
from django.template import Context, loader
from django.utils import simplejson
@@ -109,13 +109,11 @@ def edit(request, list_id):
}
return direct_to_template(request, 'general_form.html', page_dict)
-@permission_required('main.delete_todolist')
-@never_cache
-def delete_todolist(request, object_id):
- return delete_object(request, object_id=object_id, model=Todolist,
- template_name="todolists/todolist_confirm_delete.html",
- post_delete_redirect='/todo/')
-
+class DeleteTodolist(DeleteView):
+ model = Todolist
+ # model in main == assumes name 'main/todolist_confirm_delete.html'
+ template_name = 'todolists/todolist_confirm_delete.html'
+ success_url = '/todo/'
@transaction.commit_on_success
def create_todolist_packages(form, creator=None):