From b9abe996733b1ad8fd754cdc10f19e796c08ec9a Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Sat, 18 Mar 2023 15:57:36 +0100 Subject: [PATCH] add npc list to admin index --- truthinquiry/routes/routes_admin.py | 4 +++- truthinquiry/templates/admin/index.html | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/truthinquiry/routes/routes_admin.py b/truthinquiry/routes/routes_admin.py index 7f12e71..bfaf665 100644 --- a/truthinquiry/routes/routes_admin.py +++ b/truthinquiry/routes/routes_admin.py @@ -16,7 +16,9 @@ def get_or_empty(obj, key): @routes_admin.route("/") def index(): - return flask.render_template("admin/index.html") + npcs_objs = db.session.query(Npc).all() + npcs_dicts = [{"id": npc_obj.NPC_ID, "name": npc_obj.LOCALE.TEXTS[0].TEXT} for npc_obj in npcs_objs] + return flask.render_template("admin/index.html", npcs=npcs_dicts) @routes_admin.route("/npc/") def npc(npc_id): diff --git a/truthinquiry/templates/admin/index.html b/truthinquiry/templates/admin/index.html index fd722fb..a0af4a7 100644 --- a/truthinquiry/templates/admin/index.html +++ b/truthinquiry/templates/admin/index.html @@ -5,11 +5,10 @@ Reactions

NPC list :

- Diva + {%for npc in npcs%} + {{npc['name']}}
- Barron + {%endfor%}
- Machin -
- Nouveau + Nouveau NPC