From 7df08f2ce3809977c98537db03745a8e423f5f07 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Fri, 27 Jun 2008 22:13:40 -0400 Subject: add delete functionality to todo lists --- media/arch.css | 4 ++-- templates/todolists/todolist_confirm_delete.html | 24 ++++++++++++++++++++++++ templates/todolists/view.html | 9 ++++++--- urls.py | 10 +++++++++- 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 templates/todolists/todolist_confirm_delete.html diff --git a/media/arch.css b/media/arch.css index e411ff5e..76e20669 100644 --- a/media/arch.css +++ b/media/arch.css @@ -224,11 +224,11 @@ hr { border: none; border-top: 1px solid #46494d; } -.greybox input, button, textarea, select { +.greybox input, .greybox button, .greybox textarea, .greybox select { background: #e1e3e6; border: 1px solid #8faecd; } -.box input, button { +.box input, .box button { padding: 2px; background: #c1c3f6; font-size: x-small; diff --git a/templates/todolists/todolist_confirm_delete.html b/templates/todolists/todolist_confirm_delete.html new file mode 100644 index 00000000..bfa3dbab --- /dev/null +++ b/templates/todolists/todolist_confirm_delete.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} + +{% block content %} +
+

Confirm Delete

+

+ Are you sure you want to delete this todo list? +

+
+

{{object.name}}

+

+ {{object.description}} +

+
+
+
+ + +
+ + +
+{% endblock %} diff --git a/templates/todolists/view.html b/templates/todolists/view.html index f278fe4e..a1a82a41 100644 --- a/templates/todolists/view.html +++ b/templates/todolists/view.html @@ -32,11 +32,14 @@ {% endblock %} {% block content %}
- {% if perms.todolists.change_todolist %}
- Edit Todo List + {% if perms.todolist.delete_todolist %} + Delete Todo List | + {% endif %} + {% if perms.todolists.change_todolist %} + Edit Todo List + {% endif %}
- {% endif %}

ToDo List: {{ list.name }}

diff --git a/urls.py b/urls.py index 5c811bf3..0094d856 100644 --- a/urls.py +++ b/urls.py @@ -1,7 +1,9 @@ from django.conf.urls.defaults import * from django.conf import settings -from archweb_dev.main.models import News from django.views.decorators.cache import cache_page +from django.views.generic.create_update import delete_object +from django.contrib.auth.decorators import permission_required +from archweb_dev.main.models import News, Todolist urlpatterns = patterns('', # Dynamic Stuff @@ -19,6 +21,12 @@ urlpatterns = patterns('', (r'^todo/add/$', 'archweb_dev.todolists.views.add'), (r'^todo/edit/(?P\d+)/$', 'archweb_dev.todolists.views.edit'), (r'^todo/flag/(\d+)/(\d+)/$', 'archweb_dev.todolists.views.flag'), + (r'^todo/delete/(?P\d+)/$', permission_required( + 'delete_todo_list')(delete_object), { + 'model': Todolist, + 'template_name': 'todolists/todolist_confirm_delete.html', + 'post_delete_redirect': '/todo/' + }), (r'^todo/$', 'archweb_dev.todolists.views.list'), (r'^news/(\d+)/$', 'archweb_dev.news.views.view'), -- cgit v1.1-4-g5e80