diff --git a/app/routes.py b/app/routes.py index 539c7ce..58ba963 100644 --- a/app/routes.py +++ b/app/routes.py @@ -2,7 +2,7 @@ import os import re import typing as t -import peewee +from peewee import * from flask import Blueprint, abort, render_template, request, send_from_directory from playhouse.flask_utils import PaginatedQuery @@ -61,9 +61,26 @@ def acte(house=None, prince=None, acte_id=None): q_prod = Involved_in.select().where( (Involved_in.involved_in_prince == prince) &(Involved_in.invol_in_interv == 1)) - q_acte = Acte.select().where(Acte.filename == acte_id) - - return render_template("acte.html", house=house, prince=prince, infos=q_acte) + q_acte = Acte.select().where( + Acte.filename == acte_id) + for t in q_acte: + acte_place_id = t.prod_place_acte + acte_doc = t.doc_acte + acte_state_id = t.state_doc + acte_diplo_type = t.diplo_type_acte + place = [t.placename for t in Production_place.select().where( + Production_place.id_place == acte_place_id)] + doc = [[t.collection_doc, t.inst_doc] for t in Document.select().where( + Document.id_document == acte_doc)] + inst = [t.full_label for t in Institution.select().where( + Institution.id_institution == doc[0][1])] + diplo_t = [t.diplo_label for t in Diplo_type.select().where( + Diplo_type.id_diplo_type == acte_diplo_type)] + state = [t.state_label for t in State.select().where( + State.id_state == acte_state_id)] + return render_template("acte.html", house=house, prince=prince, + infos=q_acte, place=place[0], doc=doc[0][0], arch=inst[0], + diplo=diplo_t[0].replace("_", " "), state=state[0]) @main.route("/contact") def contact() -> t.Text: diff --git a/app/templates/acte.html b/app/templates/acte.html index f87c468..ca75803 100644 --- a/app/templates/acte.html +++ b/app/templates/acte.html @@ -2,10 +2,11 @@ {% block corps %}
{% for item in infos %} -

{{item.filename}}

-

{{item.date}}. — {{item.prod_place_acte}}

-

{{item.analysis}}

-

{{item.diplo_type_acte}}, {{item.state_doc}}. {{item.doc_acte}}, {{item.ref_acte}}

+

{{item.date}}{% if place != 'NS' %} + — {{place}} {% endif %}

+

{{item.filename}}

+

{{item.analysis}}.

+

{{state}}, {{diplo}}, {{arch}}, {{doc}}, {{item.ref_acte}}.

{% endfor %}
{% endblock %} \ No newline at end of file