From dfecd5d9a1b8b5e88fec4caa2eebf3ce65f381f8 Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Sun, 8 Nov 2015 14:00:07 +0100 Subject: [PATCH] Previous tut (erstmal) wieder --- modules/admin.py | 4 ++-- templates/admin_topic_show.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/admin.py b/modules/admin.py index 942cced..ba43e27 100644 --- a/modules/admin.py +++ b/modules/admin.py @@ -325,8 +325,8 @@ def statement_delete(): @admin_permission.require() def statement_undo(): topic_id = request.args.get("topic_id", None) - if statement_id is not None: - statement = Statement.query.filter_by(executed=True).order_by(db.desc(Statement.execution_time)).first() + if topic_id is not None: + statement = Statement.query.filter_by(executed=True, topic_id=topic_id).order_by(db.desc(Statement.execution_time)).first() statement.undo() db.session.commit() return redirect(url_for(".topic_show", id=topic_id)) diff --git a/templates/admin_topic_show.html b/templates/admin_topic_show.html index 429c7e0..0bf7acc 100644 --- a/templates/admin_topic_show.html +++ b/templates/admin_topic_show.html @@ -59,7 +59,7 @@ <a href="{{ url_for(".statement_done", id=topic.sorted_statements()[0].id, topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">redo</i> Next</a> </li> {% endif %} - <li><a href="{{ url_for(".statement_undo") }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li> + <li><a href="{{ url_for(".statement_undo", topic_id=topic.id) }}" class="rede-href"><i class="material-icons" role="presentation">undo</i> Previous</a></li> <li><a href="{{ url_for(".topic_show", id=topic.get_next_index()) }}"><i class="material-icons">arrow_forward</i> Next Topic</a></li> <li><a href="{{ url_for(".topic_show", id=topic.get_previous_index()) }}"><i class="material-icons">arrow_backward</i>Previous Topic</a></li> <li> -- GitLab