Mercurial > farol > farol
diff farol/document.py @ 70:727c01e8e3e9
Allow deletion of Notes
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 10:12:24 +0200 |
parents | 33cdb9faed64 |
children | f9aa7b1e697e |
line wrap: on
line diff
--- a/farol/document.py Thu Oct 09 10:11:35 2014 +0200 +++ b/farol/document.py Thu Oct 09 10:12:24 2014 +0200 @@ -213,6 +213,19 @@ get_current().addNote(note) return redirect(url_for('.view')) +@document.route('/note/del', methods=['POST']) +@document_required +def del_note(): + ordinal = int(request.form['ordinal']) + cvrf = get_current() + notes = cvrf._notes + note = cvrf.getNote(ordinal) + if note is None: + flash('Note not found', 'danger') + abort(404) + notes.remove(note) + return redirect(url_for('.view')) + @document.route('/reference/<int:index>/edit', methods=['GET', 'POST']) @document_required def edit_reference(index):