From 7ee84abb56e7612d6f962bad2de1b976dc866ba2 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sat, 3 Aug 2019 15:29:41 +0200 Subject: [PATCH] Start work on medals --- royalnet/web/royalprints/medals/__init__.py | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 royalnet/web/royalprints/medals/__init__.py diff --git a/royalnet/web/royalprints/medals/__init__.py b/royalnet/web/royalprints/medals/__init__.py new file mode 100644 index 00000000..1642afd1 --- /dev/null +++ b/royalnet/web/royalprints/medals/__init__.py @@ -0,0 +1,27 @@ +"""A :py:class:`royalnet.web.Royalprint` to create and award :py:class:`royalnet.database.tables.Medal`s.""" + +import flask as f +import os +import typing +from ...royalprint import Royalprint +from ...shortcuts import error +from ....database.tables import * +from ....utils.wikirender import prepare_page_markdown, RenderError + + +# Maybe some of these tables are optional... +tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates') +rp = Royalprint("medals", __name__, url_prefix="/medals", template_folder=tmpl_dir, + required_tables={Royal, ActiveKvGroup, Alias, Diario, Discord, Keygroup, Keyvalue, Telegram, WikiPage, + WikiRevision, Bio}) + + +@rp.route("/create", methods=["GET", "POST"], defaults={"medal_id": None}) +@rp.route("//edit", methods=["GET", "POST"]) +def medal_edit(medal_id: typing.Optional[int]): + ... + + +@rp.route("//award", methods=["GET", "POST"]) +def medal_award(medal_id: int): + ...