diff --git a/the_works/__init__.py b/the_works/__init__.py
index 7caf733..53d740c 100644
--- a/the_works/__init__.py
+++ b/the_works/__init__.py
@@ -19,9 +19,9 @@ def create_app():
init_db(app)
# register blueprints
- from the_works.views import home, text, werk, verlag, sprache, textform, werksform, genre, pseudonym, reihe
- app.register_blueprint(text.bp)
+ from the_works.views import home, text, werk, verlag, sprache, textform, werksform, genre, pseudonym, reihe, herausgeber
app.register_blueprint(home.bp)
+ app.register_blueprint(text.bp)
app.register_blueprint(werk.bp)
app.register_blueprint(verlag.bp)
app.register_blueprint(sprache.bp)
@@ -30,6 +30,7 @@ def create_app():
app.register_blueprint(genre.bp)
app.register_blueprint(pseudonym.bp)
app.register_blueprint(reihe.bp)
+ app.register_blueprint(herausgeber.bp)
### DEBUG
toolbar = DebugToolbarExtension(app)
diff --git a/the_works/models.py b/the_works/models.py
index 4f24982..47ec3c9 100644
--- a/the_works/models.py
+++ b/the_works/models.py
@@ -48,3 +48,5 @@ class Genre(db.Model):
class Pseudonym(db.Model):
__table__ = db.Model.metadata.tables['Pseudonym']
+class Herausgeber(db.Model):
+ __table__ = db.Model.metadata.tables['Herausgeber']
diff --git a/the_works/templates/_nav.html b/the_works/templates/_nav.html
index 1f78b13..d533729 100644
--- a/the_works/templates/_nav.html
+++ b/the_works/templates/_nav.html
@@ -19,5 +19,6 @@
Genres
Pseudonyme
Reihen
+ Herausgeber:innen
diff --git a/the_works/templates/views/herausgeber.html b/the_works/templates/views/herausgeber.html
new file mode 100644
index 0000000..031ad3f
--- /dev/null
+++ b/the_works/templates/views/herausgeber.html
@@ -0,0 +1,103 @@
+{% extends 'base.html' %}
+
+{% block title %}Herausgeber:innen{% endblock title %}
+
+{% block script %}
+{% endblock script %}
+
+{% block heading %}Herausgeber:innen{% endblock heading %}
+
+{% block content %}
+
+{% include "_icons.svg" %}
+
+
+
+
+ | Name |
+ Aktionen |
+
+
+
+ {% for hrsg in herausgeber %}
+
+ | {{ hrsg["Name"] }} |
+ |
+ |
+
+ {% endfor %}
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/the_works/views/herausgeber.py b/the_works/views/herausgeber.py
new file mode 100644
index 0000000..a037f63
--- /dev/null
+++ b/the_works/views/herausgeber.py
@@ -0,0 +1,39 @@
+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 Herausgeber
+
+bp = Blueprint("herausgeber", __name__)
+
+@bp.route("/herausgeber")
+@bp.route("/herausgeber/all")
+def all():
+ return render_template("views/herausgeber.html", herausgeber=db.session.scalars(select(Herausgeber)))
+
+@bp.route("/text/herausgeber/")
+def read(id):
+ return db.session.get(Herausgeber, id)
+
+@bp.route("/herausgeber/create", methods=["POST"])
+def create():
+ db.session.add(Herausgeber(Name = request.form["form_Name"]))
+ db.session.commit()
+ flash("Eintrag erfolgreich hinzugefügt")
+ return redirect(url_for("herausgeber.all"), code=303)
+
+@bp.route("/herausgeber/update/", methods=["POST"])
+def update(id):
+ herausgeber = db.session.get(Herausgeber, id)
+ herausgeber.Name = request.form["form_Name"]
+ db.session.commit()
+ flash("Eintrag erfolgreich geändert")
+ return redirect(url_for("herausgeber.all"), code=303)
+
+@bp.route("/herausgeber/delete/")
+def delete(id):
+ herausgeber = db.session.get(Herausgeber, id)
+ db.session.delete(herausgeber)
+ db.session.commit()
+ flash("Eintrag erfolgreich gelöscht")
+ return redirect(url_for("herausgeber.all"))
+