renamed "pages" to "views"; added db support

This commit is contained in:
eclipse 2025-04-18 16:00:30 +02:00
parent b7fff0d9fc
commit 764be702c7
2 changed files with 25 additions and 11 deletions

View File

@ -1,11 +0,0 @@
from flask import Blueprint, render_template
bp = Blueprint("pages", __name__)
@bp.route("/")
def home():
return render_template("pages/home.html")
@bp.route("/about")
def about():
return render_template("pages/about.html")

25
the_works/views.py Normal file
View File

@ -0,0 +1,25 @@
from flask import Blueprint, render_template
from the_works.database import get_db
bp = Blueprint("views", __name__)
@bp.route("/")
def home():
return render_template("views/home.html")
@bp.route("/texte")
def texte():
db = get_db()
rows = db.execute(
"""SELECT
t.Titel AS Titel,
t.Untertitel AS Untertitel,
r.Reihentitel AS Reihe,
f.Textform AS Textform,
s.Sprache AS Originalsprache
FROM Texte t
LEFT JOIN Reihen r ON t.Reihe = r.ID
LEFT JOIN Textformen f ON t.Textform = f.ID
LEFT JOIN Sprachen s ON t.Originalsprache = s.ID;"""
).fetchall()
return render_template("views/texte.html", rows=rows)