diff --git a/the_works/__init__.py b/the_works/__init__.py index 6d1dd6f..034e4bd 100644 --- a/the_works/__init__.py +++ b/the_works/__init__.py @@ -26,9 +26,10 @@ def create_app(): init_db(app) # register blueprints - from the_works.views import home, text + from the_works.views import home, text, werk app.register_blueprint(text.bp) app.register_blueprint(home.bp) + app.register_blueprint(werk.bp) # load debug toolbar toolbar = DebugToolbarExtension(app) diff --git a/the_works/models.py b/the_works/models.py index 3fbbd13..ac4e416 100644 --- a/the_works/models.py +++ b/the_works/models.py @@ -3,25 +3,41 @@ from sqlalchemy.orm import relationship class Text(db.Model): __table__ = db.Model.metadata.tables['Text'] - reihe = relationship("Reihe", back_populates="texte") - textform = relationship("Textform", back_populates="texte") - sprache = relationship("Sprache", back_populates="texte") + reihe = relationship("Reihe", back_populates="text") + textform = relationship("Textform", back_populates="text") + sprache = relationship("Sprache", back_populates="text") def __repr__(self): return f"Text(ID={self.ID}, Titel={self.Titel}, Untertitel={self.Untertitel}, Reihe={self.Reihe})" class Werk(db.Model): __table__ = db.Model.metadata.tables['Werk'] + reihe = relationship("Reihe", back_populates="werk") + verlag = relationship("Verlag", back_populates="werk") + werksform = relationship("Werksform", back_populates="werk") + + def __repr__(self): + return f"Werk(ID={self.ID}, Titel={self.Titel}, Untertitel={self.Untertitel}, Erscheinungsdatum={self.Erscheinungsdatum})" class Reihe(db.Model): __table__ = db.Model.metadata.tables['Reihe'] - texte = relationship("Text", back_populates="reihe") + text = relationship("Text", back_populates="reihe") + werk = relationship("Werk", back_populates="reihe") class Textform(db.Model): __table__ = db.Model.metadata.tables['Textform'] - texte = relationship("Text", back_populates="textform") + text = relationship("Text", back_populates="textform") class Sprache(db.Model): __table__ = db.Model.metadata.tables['Sprache'] - texte = relationship("Text", back_populates="sprache") + text = relationship("Text", back_populates="sprache") + +class Verlag(db.Model): + __table__ = db.Model.metadata.tables['Verlag'] + werk = relationship("Werk", back_populates="verlag") + +class Werksform(db.Model): + __table__ = db.Model.metadata.tables['Werksform'] + werk = relationship("Werk", back_populates="werksform") + diff --git a/the_works/templates/_nav.html b/the_works/templates/_nav.html index 2b9a336..167f8c1 100644 --- a/the_works/templates/_nav.html +++ b/the_works/templates/_nav.html @@ -2,5 +2,6 @@
diff --git a/the_works/templates/views/werk.html b/the_works/templates/views/werk.html new file mode 100644 index 0000000..83bd351 --- /dev/null +++ b/the_works/templates/views/werk.html @@ -0,0 +1,92 @@ +{% extends 'base.html' %} + +{% block title %}Werke{% endblock title %} + +{% block heading %}Werke{% endblock heading %} + +{% block content %} + +{% include "_icons.svg" %} + +{# {% include "views/_textmodal.js" %} #} + +