From 9070fb79dd641e7c3499628acecd1695d43d68a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Mon, 24 Dec 2012 09:35:59 +0100 Subject: [PATCH] Request confirmation before deleting one item --- templates/category.html | 2 +- templates/tag.html | 2 +- templates/view_blog.html | 4 ++-- views.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/category.html b/templates/category.html index 4e8dfac..9fb7fb9 100644 --- a/templates/category.html +++ b/templates/category.html @@ -7,7 +7,7 @@ {% else %} {% for category in categories %} - + {% endfor %}
{{ category.id }}{{ category.name }}EditDelete
{{ category.id }}{{ category.name }}EditDelete
{% endif %} diff --git a/templates/tag.html b/templates/tag.html index 3341a4d..21ec95f 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -7,7 +7,7 @@ {% else %} {% for tag in tags %} - + {% endfor %}
{{ tag.id }}{{ tag.name }}EditDelete
{{ tag.id }}{{ tag.name }}EditDelete
{% endif %} diff --git a/templates/view_blog.html b/templates/view_blog.html index 3b98a8d..d0ae6f1 100644 --- a/templates/view_blog.html +++ b/templates/view_blog.html @@ -6,7 +6,7 @@
{% csrf_token %} {{ form.as_p }} - +
{% endif %}

@@ -19,7 +19,7 @@ {% for post in posts %} {% with post.id as cur_id %} - + {% endwith %} {% endfor %} {% endif %} diff --git a/views.py b/views.py index c843abb..6407960 100644 --- a/views.py +++ b/views.py @@ -222,7 +222,7 @@ def edit_category(request, category_id): form = CategoryForm(request.POST, instance=category) # A form bound to the POST data if form.is_valid(): # All validation rules pass if request.POST['name'] != name: - category.remove() + category.remove(b) form.save() return HttpResponseRedirect('/category/' + str(b.id)) else: @@ -241,7 +241,7 @@ def delete_category(request, category_id): b,_ = have_I_right(request, category.blog.id) - category.remove() + category.remove(b) category.delete() return HttpResponseRedirect('/category/' + str(b.id))
{{ post.id }}{{ post.title }}{{ post.category.name }}{{ post.creation_date }}{{ post.modification_date }}{{ post.published }}{{ post.front_page }}{{ comments|hash:cur_id|default_if_none:"0" }} comment{{ comments|hash:cur_id|pluralize }}Delete
{{ post.id }}{{ post.title }}{{ post.category.name }}{{ post.creation_date }}{{ post.modification_date }}{{ post.published }}{{ post.front_page }}{{ comments|hash:cur_id|default_if_none:"0" }} comment{{ comments|hash:cur_id|pluralize }}Delete