Mercurial > farol > farol
diff farol/document.py @ 72:f9aa7b1e697e
Add possibility to delete References
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 10:31:06 +0200 |
parents | 727c01e8e3e9 |
children | 88adf067cae1 |
line wrap: on
line diff
--- a/farol/document.py Thu Oct 09 10:24:56 2014 +0200 +++ b/farol/document.py Thu Oct 09 10:31:06 2014 +0200 @@ -250,6 +250,17 @@ get_current().addReference(ref) return redirect(url_for('.view')) +@document.route('/reference/del', methods=['POST']) +@document_required +def del_reference(): + index = int(request.form['index']) + refs = get_current()._references + if not (0 <= index < len(refs)): + flash('Reference not found', 'danger') + abort(404) + del refs[index] + return redirect(url_for('.view')) + @document.route('/acknowledgment/<int:index>') @document_required def view_acknowledgment(index):