diff --git a/the_works/__init__.py b/the_works/__init__.py
index 4bb6ab8..1aa58b2 100644
--- a/the_works/__init__.py
+++ b/the_works/__init__.py
@@ -19,11 +19,12 @@ def create_app():
init_db(app)
# register blueprints
- from the_works.views import home, text, werk, verlag
+ from the_works.views import home, text, werk, verlag, sprache
app.register_blueprint(text.bp)
app.register_blueprint(home.bp)
app.register_blueprint(werk.bp)
app.register_blueprint(verlag.bp)
+ app.register_blueprint(sprache.bp)
### DEBUG
app.config["SQLALCHEMY_ECHO"] = True
diff --git a/the_works/templates/_nav.html b/the_works/templates/_nav.html
index 376b98b..43a11a1 100644
--- a/the_works/templates/_nav.html
+++ b/the_works/templates/_nav.html
@@ -13,5 +13,6 @@
Texte
Werke
Verlage
+ Sprachen
diff --git a/the_works/templates/views/sprache.html b/the_works/templates/views/sprache.html
new file mode 100644
index 0000000..66b4c35
--- /dev/null
+++ b/the_works/templates/views/sprache.html
@@ -0,0 +1,103 @@
+{% extends 'base.html' %}
+
+{% block title %}Sprachen{% endblock title %}
+
+{% block script %}
+{% endblock script %}
+
+{% block heading %}Verlage{% endblock heading %}
+
+{% block content %}
+
+{% include "_icons.svg" %}
+
+
+
+
+ | Sprachen |
+ Aktionen |
+
+
+
+ {% for sprache in sprachen %}
+
+ | {{ sprache["Sprache"] }} |
+ |
+ |
+
+ {% endfor %}
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/the_works/views/sprache.py b/the_works/views/sprache.py
new file mode 100644
index 0000000..bb47db9
--- /dev/null
+++ b/the_works/views/sprache.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 Sprache
+
+bp = Blueprint("sprache", __name__)
+
+@bp.route("/sprache")
+@bp.route("/sprache/all")
+def all():
+ return render_template("views/sprache.html", sprachen=db.session.scalars(select(Sprache)))
+
+@bp.route("/sprache/verlag/")
+def read(id):
+ return db.session.get(Sprache, id)
+
+@bp.route("/sprache/create", methods=["POST"])
+def create():
+ db.session.add(Sprache(Sprache = request.form["form_Sprache"]))
+ db.session.commit()
+ flash("Eintrag erfolgreich hinzugefügt")
+ return redirect(url_for("sprache.all"))
+
+@bp.route("/sprache/update/", methods=["POST"])
+def update(id):
+ sprache = db.session.get(Sprache, id)
+ sprache.Sprache = request.form["form_Sprache"]
+ db.session.commit()
+ flash("Eintrag erfolgreich geändert")
+ return redirect(url_for("sprache.all"))
+
+@bp.route("/sprache/delete/")
+def delete(id):
+ sprache = db.session.get(Sprache, id)
+ db.session.delete(sprache)
+ db.session.commit()
+ flash("Eintrag erfolgreich gelöscht")
+ return redirect(url_for("sprache.all"))
+