diff --git a/CTFd/admin.py b/CTFd/admin.py index a4f532a4..9182d1bd 100644 --- a/CTFd/admin.py +++ b/CTFd/admin.py @@ -155,6 +155,13 @@ def init_admin(app): pages = Pages.query.all() return render_template('admin/pages.html', routes=pages) + @app.route('/admin/page//delete', methods=['POST']) + @admins_only + def delete_page(pageroute): + page = Pages.query.filter_by(route=pageroute).first() + db.session.delete(page) + db.session.commit() + return '1' @app.route('/admin/hosts', methods=['GET']) @admins_only diff --git a/templates/admin/pages.html b/templates/admin/pages.html index 518113d6..1f04675c 100644 --- a/templates/admin/pages.html +++ b/templates/admin/pages.html @@ -3,16 +3,31 @@ {% block content %}

+
+

Delete Page

+
+ + +
+

Are you sure you want to delete ?

+ + +
+
+ × +
+ {% for route in routes %} - - + + + {% endfor %} @@ -25,4 +40,30 @@ {% endblock %} {% block scripts %} + {% endblock %}
RouteSettings
{{ route.route }}
{{ route.route }}