Merge pull request #99 from ThomasRubini/admin_index

This commit is contained in:
Thomas Rubini 2023-03-18 15:58:04 +01:00 committed by GitHub
commit d329be91fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -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/<npc_id>")
def npc(npc_id):

View File

@ -5,11 +5,10 @@
<a href="/admin/reactions"> Reactions </a>
<section>
<p> NPC list :</p>
<a href="/admin/npc/1"> Diva </a>
{%for npc in npcs%}
<a href="/admin/npc/{{npc['id']}}"> {{npc['name']}} </a>
<br>
<a href="/admin/npc/2"> Barron </a>
{%endfor%}
<br>
<a href="/admin/npc/3"> Machin </a>
<br>
<a href="/admin/npc/new"> Nouveau </a>
<a href="/admin/npc/new"> Nouveau NPC </a>
</section>