add traits back office view

This commit is contained in:
Thomas Rubini 2023-03-18 16:38:27 +01:00
parent 5cbfc79809
commit 969ef67c08
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373
5 changed files with 25 additions and 3 deletions

View File

@ -159,7 +159,10 @@ class Trait(Base):
self.DESC_LID = DESC_LID
def __str__(self) -> str:
return f"{self.TRAIT_ID} {self.NAME_LID}"
return f"Trait(TRAIT_ID={self.TRAIT_ID}, NAME_LID={self.NAME_LID}, DESC_LID={self.DESC_LID})"
def __repr__(self) -> str:
return self.__str__()
class Reaction(Base):

View File

@ -40,3 +40,9 @@ def places():
places_objs = db.session.query(Place).all()
places_dicts = [{"id": place_obj.PLACE_ID, "name": place_obj.LOCALE.TEXTS[0].TEXT} for place_obj in places_objs]
return flask.render_template("admin/places.html", places=places_dicts)
@routes_admin.route("/traits")
def traits():
traits_objs = db.session.query(Trait).all()
traits_dicts = [{"id": trait_obj.TRAIT_ID, "name": trait_obj.Name.TEXTS[0].TEXT, "desc": trait_obj.Desc.TEXTS[0].TEXT} for trait_obj in traits_objs]
return flask.render_template("admin/traits.html", traits=traits_dicts)

View File

@ -2,7 +2,7 @@
<br>
<a href="/admin/places"> Places </a>
<br>
<a href="/admin/reactions"> Reactions </a>
<a href="/admin/traits"> Traits </a>
<section>
<p> NPC list :</p>
{%for npc in npcs%}

View File

@ -1 +0,0 @@
<a href="/admin"> go Back </a> <br>

View File

@ -0,0 +1,14 @@
<a href="/admin"> go Back </a> <br>
<section>
{%for trait in traits%}
<section id="{{trait['id']}}">
<p> Name: </p>
<input value="{{trait['name']}}">
<p> Description: </p>
<input value="{{trait['desc']}}">
</section>
{%endfor%}
</section>
<p>Images are viewable in the npc views</p>