diff --git a/the_works/__init__.py b/the_works/__init__.py
index 969e344..7caf733 100644
--- a/the_works/__init__.py
+++ b/the_works/__init__.py
@@ -19,7 +19,7 @@ def create_app():
init_db(app)
# register blueprints
- from the_works.views import home, text, werk, verlag, sprache, textform, werksform, genre, pseudonym
+ from the_works.views import home, text, werk, verlag, sprache, textform, werksform, genre, pseudonym, reihe
app.register_blueprint(text.bp)
app.register_blueprint(home.bp)
app.register_blueprint(werk.bp)
@@ -29,6 +29,7 @@ def create_app():
app.register_blueprint(werksform.bp)
app.register_blueprint(genre.bp)
app.register_blueprint(pseudonym.bp)
+ app.register_blueprint(reihe.bp)
### DEBUG
toolbar = DebugToolbarExtension(app)
diff --git a/the_works/templates/_nav.html b/the_works/templates/_nav.html
index 2fee435..1f78b13 100644
--- a/the_works/templates/_nav.html
+++ b/the_works/templates/_nav.html
@@ -18,5 +18,6 @@
Werksformen
Genres
Pseudonyme
+ Reihen
diff --git a/the_works/templates/views/reihe.html b/the_works/templates/views/reihe.html
new file mode 100644
index 0000000..2acac53
--- /dev/null
+++ b/the_works/templates/views/reihe.html
@@ -0,0 +1,114 @@
+{% extends 'base.html' %}
+
+{% block title %}Reihen{% endblock title %}
+
+{% block script %}
+{% endblock script %}
+
+{% block heading %}Reihen{% endblock heading %}
+
+{% block content %}
+
+{% include "_icons.svg" %}
+
+
+
+
+ | Reihe |
+ Verlag |
+ Aktionen |
+
+
+
+ {% for reihe in reihen %}
+
+ | {{ reihe["Titel"] }} |
+ {{ reihe["Verlag"] }} |
+ |
+ |
+
+ {% endfor %}
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/the_works/views/reihe.py b/the_works/views/reihe.py
new file mode 100644
index 0000000..1fedead
--- /dev/null
+++ b/the_works/views/reihe.py
@@ -0,0 +1,56 @@
+from flask import Blueprint, render_template, request, redirect, flash, url_for
+from sqlalchemy import select, insert, update, delete
+from the_works.database import db
+from the_works.models import Reihe, Verlag
+
+bp = Blueprint("reihe", __name__)
+
+@bp.route("/reihe")
+@bp.route("/reihe/all")
+def all():
+ rows = db.session.execute(select(Reihe, Verlag).join(Reihe.verlag, isouter=True))
+ reihen = []
+ for row in rows:
+ reihen.append({
+ "id": row.Reihe.ID,
+ "Titel": row.Reihe.Titel,
+ "Verlag": row.Verlag.Verlag if row.Verlag else "",
+ "v_id": row.Reihe.Verlag or ""
+ })
+ return render_template("views/reihe.html", reihen=reihen, verlage=db.session.scalars(select(Verlag)))
+
+@bp.route("/text/reihe/")
+def read(id):
+ reihe = db.session.get(Genre, id)
+ return {
+ "Titel": reihe.Titel,
+ "Verlag": reihe.Verlag or ""
+ }
+
+@bp.route("/reihe/create", methods=["POST"])
+def create():
+ db.session.add(Reihe(
+ Titel = request.form["form_Titel"],
+ Verlag = request.form["form_Verlag"]
+ ))
+ db.session.commit()
+ flash("Eintrag erfolgreich hinzugefügt")
+ return redirect(url_for("reihe.all"), code=303)
+
+@bp.route("/reihe/update/", methods=["POST"])
+def update(id):
+ reihe = db.session.get(Reihe, id)
+ reihe.Titel = request.form["form_Titel"]
+ reihe.Verlag = request.form["form_Verlag"]
+ db.session.commit()
+ flash("Eintrag erfolgreich geändert")
+ return redirect(url_for("reihe.all"), code=303)
+
+@bp.route("/reihe/delete/")
+def delete(id):
+ reihe = db.session.get(Reihe, id)
+ db.session.delete(reihe)
+ db.session.commit()
+ flash("Eintrag erfolgreich gelöscht")
+ return redirect(url_for("reihe.all"))
+