Permalink
Browse files

add tag delete view

  • Loading branch information...
copelco committed Nov 16, 2010
1 parent 79d8629 commit ab59541a90d45b253d5da9b7277bafc59e8ef791
@@ -28,7 +28,7 @@ <h2>Tags</h2>
</a>
</td>
<td>
- <a href="{#% url delete_question question.id %#}" title="Edit" class="delete-link">
+ <a href="{% url delete-tag tag.id %}" title="Edit" class="delete-link">
<img class='action' alt='Delete' src="{{ MEDIA_URL }}group_messaging/delete-icon.png" />
</a>
</td>
@@ -26,6 +26,8 @@
name='create-tag'),
url(r'^tree/tags/(?P<tag_id>\d+)/edit/$', views.create_edit_tag,
name='edit-tag'),
+ url(r'^tree/tags/(?P<tag_id>\d+)/delete/$', views.delete_tag,
+ name='delete-tag'),
(r'^tree/data/export$', views.export),
(r'^tree/data/export/(?P<id>\d+)$', views.export),
@@ -481,3 +481,13 @@ def create_edit_tag(request, tag_id=None):
}
return render_to_response("tree/tags/edit.html", context,
context_instance=RequestContext(request))
+
+
+@login_required
+@transaction.commit_on_success
+def delete_tag(request, tag_id):
+ tag = get_object_or_404(Tag, pk=tag_id)
+ tag.delete()
+ messages.info(request, 'Tag successfully deleted')
+ return HttpResponseRedirect(reverse('list-tags'))
+

0 comments on commit ab59541

Please sign in to comment.