# HG changeset patch # User BenoƮt Allard # Date 1412861871 -7200 # Node ID 521c0ec35338a568695d7c08240cdcb599fb0fd7 # Parent e02724c84bae4c99a3b36b520ead5c8e210ae52a Add deletion of Groups diff -r e02724c84bae -r 521c0ec35338 farol/producttree.py --- a/farol/producttree.py Thu Oct 09 15:16:30 2014 +0200 +++ b/farol/producttree.py Thu Oct 09 15:37:51 2014 +0200 @@ -326,3 +326,18 @@ group.addProductID(productid) get_current()._producttree.addGroup(group) return redirect(url_for('.view')) + +@producttree.route('/group//del', methods=['POST']) +@document_required +@producttree_required +def del_group(groupid): + cvrf = get_current() + try: + group = get_current().getGroupForID(groupid) + except KeyError: + flash('Group not found', 'danger') + abort(404) + + cvrf._producttree._groups.remove(group) + return redirect(url_for('.view')) + diff -r e02724c84bae -r 521c0ec35338 farol/templates/producttree/view.j2 --- a/farol/templates/producttree/view.j2 Thu Oct 09 15:16:30 2014 +0200 +++ b/farol/templates/producttree/view.j2 Thu Oct 09 15:37:51 2014 +0200 @@ -84,7 +84,10 @@ {% call panel(heading="Groups", badge=producttree._groups | length, title=4) %} {% for group in producttree._groups %} {% call panel() %} - edit +
+ edit + {{ delete_button(url_for('.del_group', groupid=group._groupid)) }} +