diff --git a/the_works/templates/_icons.svg b/the_works/templates/_icons.svg index b6474d0..38d12dc 100644 --- a/the_works/templates/_icons.svg +++ b/the_works/templates/_icons.svg @@ -1,10 +1,15 @@ - + + + + + + diff --git a/the_works/templates/_nav.html b/the_works/templates/_nav.html index 167f8c1..dd8f634 100644 --- a/the_works/templates/_nav.html +++ b/the_works/templates/_nav.html @@ -1,7 +1,7 @@ diff --git a/the_works/templates/views/_textmodal.js b/the_works/templates/views/_textmodal.js index a47e8e2..38f5074 100644 --- a/the_works/templates/views/_textmodal.js +++ b/the_works/templates/views/_textmodal.js @@ -1,23 +1,23 @@ \ No newline at end of file diff --git a/the_works/templates/views/home.html b/the_works/templates/views/home.html index 73257eb..933d72e 100644 --- a/the_works/templates/views/home.html +++ b/the_works/templates/views/home.html @@ -5,5 +5,5 @@ {% block heading %}Home{% endblock heading %} {% block content %} -

Alle Texte

+

Alle Texte

{% endblock content %} \ No newline at end of file diff --git a/the_works/templates/views/text.html b/the_works/templates/views/text.html index 4f747e6..4fdbab5 100644 --- a/the_works/templates/views/text.html +++ b/the_works/templates/views/text.html @@ -32,12 +32,12 @@ {% for text in texte %} - {{ text["titel"] }} - {{ text["untertitel"] }} - {{ text["reihe"] }} - {{ text["textform"] }} - {{ text["sprache"] }} - + {{ text["Titel"] }} + {{ text["Untertitel"] }} + {{ text["Reihe"] }} + {{ text["Textform"] }} + {{ text["Sprache"] }} + {% endfor %} @@ -54,15 +54,15 @@
- +
diff --git a/the_works/templates/views/werk.html b/the_works/templates/views/werk.html index 83bd351..c4206d3 100644 --- a/the_works/templates/views/werk.html +++ b/the_works/templates/views/werk.html @@ -32,13 +32,13 @@ {% for werk in werke %} - {{ werk["titel"] }} - {{ werk["untertitel"] }} - {{ werk["reihe"] }} - {{ werk["verlag"] }} - {{ werk["werksform"] }} - - + {{ werk["Titel"] }} + {{ werk["Untertitel"] }} + {{ werk["Reihe"] }} + {{ werk["Verlag"] }} + {{ werk["Werksform"] }} + + {% endfor %} diff --git a/the_works/views/text.py b/the_works/views/text.py index dcdc680..61718ae 100644 --- a/the_works/views/text.py +++ b/the_works/views/text.py @@ -5,9 +5,9 @@ from the_works.models import Text, Reihe, Sprache, Textform bp = Blueprint("text", __name__) -@bp.route("/text/all") @bp.route("/text") -def read(): +@bp.route("/text/all") +def all(): # build ORM equivalent of SELECT statement stmt = ( select(Text, Reihe, Textform, Sprache) @@ -20,13 +20,13 @@ def read(): for row in db.session.execute(stmt): texte.append({ "id": row.Text.ID, - "titel": row.Text.Titel, - "untertitel": row.Text.Untertitel or "", - "reihe": row.Reihe.Titel if row.Reihe else "", + "Titel": row.Text.Titel, + "Untertitel": row.Text.Untertitel or "", + "Reihe": row.Reihe.Titel if row.Reihe else "", "r_id": str(row.Reihe.ID) if row.Reihe else "", - "textform": row.Textform.Textform if row.Textform else "", + "Textform": row.Textform.Textform if row.Textform else "", "tf_id": str(row.Textform.ID) if row.Textform else "", - "sprache": row.Sprache.Sprache, + "Sprache": row.Sprache.Sprache, "s_id": str(row.Sprache.ID) if row.Sprache else "" }) return render_template("views/text.html", texte=texte, reihen=db.session.scalars(select(Reihe)), textformen=db.session.scalars(select(Textform)), sprachen=db.session.scalars(select(Sprache))) @@ -34,30 +34,30 @@ def read(): @bp.route("/text/create", methods=["POST"]) def create(): db.session.add(Text( - Titel = request.form["text_titel"], - Untertitel = request.form["text_untertitel"] or None, - Reihe = request.form["text_reihe"] or None, - Textform = request.form["text_textform"], - Sprache = request.form["text_sprache"] + Titel = request.form["form_Titel"], + Untertitel = request.form["form_Untertitel"] or None, + Reihe = request.form["form_Reihe"] or None, + Textform = request.form["form_Textform"], + Sprache = request.form["form_Sprache"] )) db.session.commit() flash("Eintrag erfolgreich hinzugefügt") - return redirect(url_for("text.read")) + return redirect(url_for("text.all")) @bp.route("/text/update/", methods=["POST"]) def update(id): # get record text = db.session.get(Text, id) # update values - text.Titel = request.form["text_titel"] - text.Untertitel = request.form["text_untertitel"] or None - text.Reihe = request.form["text_reihe"] or None - text.Textform = request.form["text_textform"] - text.Sprache = request.form["text_sprache"] + text.Titel = request.form["form_Titel"] + text.Untertitel = request.form["form_Untertitel"] or None + text.Reihe = request.form["form_Reihe"] or None + text.Textform = request.form["form_Textform"] + text.Sprache = request.form["form_Sprache"] # commit changes db.session.commit() flash("Eintrag erfolgreich geändert") - return redirect(url_for("text.read")) + return redirect(url_for("text.all")) @bp.route("/text/delete/") @@ -66,5 +66,5 @@ def delete(id): db.session.delete(text) db.session.commit() flash("Eintrag erfolgreich gelöscht") - return redirect(url_for("text.read")) + return redirect(url_for("text.all")) diff --git a/the_works/views/werk.py b/the_works/views/werk.py index 388054c..8650e8b 100644 --- a/the_works/views/werk.py +++ b/the_works/views/werk.py @@ -5,9 +5,9 @@ from the_works.models import Werk, Reihe, Verlag, Werksform bp = Blueprint("werk", __name__) -@bp.route("/werk/all") @bp.route("/werk") -def read(): +@bp.route("/werk/all") +def all(): # build ORM equivalent of SELECT statement stmt = ( select(Werk, Reihe, Verlag, Werksform) @@ -20,16 +20,19 @@ def read(): for row in db.session.execute(stmt): werke.append({ "id": row.Werk.ID, - "titel": row.Werk.Titel, - "untertitel": row.Werk.Untertitel or "", - "reihe": row.Reihe.Titel if row.Reihe else "", - "r_id": str(row.Reihe.ID) if row.Reihe else "", - "verlag": row.Verlag.Verlag if row.Verlag else "", - "v_id": str(row.Verlag.ID) if row.Verlag else "", - "werksform": row.Werksform.Werksform if row.Werksform else "", - "wf_id": str(row.Werksform.ID) if row.Werksform else "" + "Titel": row.Werk.Titel, + "Untertitel": row.Werk.Untertitel or "", + "Reihe": row.Reihe.Titel if row.Reihe else "", + "Verlag": row.Verlag.Verlag if row.Verlag else "", + "Werksform": row.Werksform.Werksform if row.Werksform else "", }) - return render_template("views/werk.html", werke=werke, reihen=db.session.scalars(select(Reihe)), verlage=db.session.scalars(select(Verlag)), werksformen=db.session.scalars(select(Werksform))) + return render_template("views/werk.html", werke=werke) + + +@bp.route("/werk/read/") +def read(): + werk = db.session.get(Werk, id) + return render_template("views/werk_read.html", werk=werk) @bp.route("/werk/create", methods=["POST"]) def create(): @@ -43,7 +46,7 @@ def create(): db.session.commit() flash("Eintrag erfolgreich hinzugefügt") """ - return redirect(url_for("werk.read")) + return redirect(url_for("werk.all")) @bp.route("/werk/update/", methods=["POST"]) def update(id): @@ -59,7 +62,7 @@ def update(id): db.session.commit() flash("Eintrag erfolgreich geändert") """ - return redirect(url_for("werk.read")) + return redirect(url_for("werk.all")) @bp.route("/werk/delete/") @@ -69,4 +72,4 @@ def delete(id): db.session.commit() flash("Eintrag erfolgreich gelöscht") """ - return redirect(url_for("werk.read")) + return redirect(url_for("werk.all"))