From b7fe5de12be5c9f02adeedba45befee751ea68be Mon Sep 17 00:00:00 2001 From: Gareth Coles Date: Mon, 14 May 2018 20:42:41 +0100 Subject: Migration runner and migrations (#69) * Migration runner and migrations * Remove demo wiki data * [Staff] Table management pages * Fix weird travis build omission * Address review and comments by @Volcyy * [Tables] Fix pagination * Move table definitions to new file with nameduple * Linting * Address lemon's review comments * Address @Volcyy's review * Address lemon's review * Update search placeholder * Search by key now available --- pysite/views/staff/tables/table_bare.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 pysite/views/staff/tables/table_bare.py (limited to 'pysite/views/staff/tables/table_bare.py') diff --git a/pysite/views/staff/tables/table_bare.py b/pysite/views/staff/tables/table_bare.py new file mode 100644 index 00000000..abd6cb19 --- /dev/null +++ b/pysite/views/staff/tables/table_bare.py @@ -0,0 +1,30 @@ +from flask import redirect, request, url_for +from werkzeug.exceptions import NotFound + +from pysite.base_route import RouteView +from pysite.constants import TABLE_MANAGER_ROLES +from pysite.decorators import require_roles +from pysite.mixins import DBMixin +from pysite.tables import TABLES + + +class TableView(RouteView, DBMixin): + path = "/tables/" + name = "tables.table_bare" + + @require_roles(*TABLE_MANAGER_ROLES) + def get(self, table): + if table not in TABLES: + raise NotFound() + + search = request.args.get("search") + + args = { + "table": table, + "page": 1 + } + + if search is not None: + args["search"] = search + + return redirect(url_for("staff.tables.table", **args)) -- cgit v1.2.3