|
|
|
|
import os
|
|
|
|
|
import re
|
|
|
|
|
import typing as t
|
|
|
|
|
|
|
|
|
|
import peewee
|
|
|
|
|
from flask import Blueprint, abort, render_template, request, send_from_directory
|
|
|
|
|
from playhouse.flask_utils import PaginatedQuery
|
|
|
|
|
|
|
|
|
|
from .app import APPPATH
|
|
|
|
|
from .modeles import Institution, State, House, Production_place, Diplo_type, Document, Acte, Individual, Produced_by
|
|
|
|
|
|
|
|
|
|
RESULT_PAR_PAGES = 5
|
|
|
|
|
|
|
|
|
|
main = Blueprint("main", __name__, url_prefix="/")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route("/")
|
|
|
|
|
def home():
|
|
|
|
|
"""home route"""
|
|
|
|
|
return render_template("home.html")
|
|
|
|
|
|
|
|
|
|
@main.route("/about/")
|
|
|
|
|
def about():
|
|
|
|
|
"""home route"""
|
|
|
|
|
return render_template("about.html")
|
|
|
|
|
|
|
|
|
|
@main.route("/actes/")
|
|
|
|
|
def corpora_all():
|
|
|
|
|
"""copora all route"""
|
|
|
|
|
return render_template("corpora_all.html")
|
|
|
|
|
|
|
|
|
|
@main.route("/actes/<house>") # dont put a slash at the end
|
|
|
|
|
def actes(house):
|
|
|
|
|
"""actes route"""
|
|
|
|
|
prince_q = [t.name_indiv for t in Individual.select().where(
|
|
|
|
|
Individual.role_indiv == 'prince')]
|
|
|
|
|
house_q = [t.id_duke for t in Duke.select().where(
|
|
|
|
|
Duke.indiv_duke == prince_q[0])]
|
|
|
|
|
return render_template("corpus.html", house=house, princes=prince_q)
|
|
|
|
|
|
|
|
|
|
@main.route("/actes/<house>/<prince>") # dont put a slash at the end
|
|
|
|
|
def prince_corpus(house=None, prince=None):
|
|
|
|
|
"""copora prince route"""
|
|
|
|
|
return render_template("prince_corpus.html", house=house, prince=prince)
|
|
|
|
|
|
|
|
|
|
@main.route("/contact")
|
|
|
|
|
def contact() -> t.Text:
|
|
|
|
|
"""Displays the Contact page"""
|
|
|
|
|
return render_template("contact.html", title="Contact")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route("/termsofservice")
|
|
|
|
|
def terms() -> t.Text:
|
|
|
|
|
"""Displaysthe T&C page."""
|
|
|
|
|
return render_template("terms.html", title="Mentions légales")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@main.route("/privacy")
|
|
|
|
|
def privacy() -> t.Text:
|
|
|
|
|
"""Displays the privacy policy page."""
|
|
|
|
|
return render_template("privacy.html", title="Politique de confidentialité")
|