diff --git a/the_works/__init__.py b/the_works/__init__.py index 356652e..c086ab1 100644 --- a/the_works/__init__.py +++ b/the_works/__init__.py @@ -1,9 +1,9 @@ from flask import Flask import dotenv # this import is not strictly necessary but it forces pipreqs-to include dotenv when generating `requirements.txt` from the_works.database import init_db -from the_works.models import CLASSVIEWABLE_MODELS +from the_works.models import SIMPLE_MODELS from the_works.views import home, text, werk, reihe, veroeffentlichung, titelbild -from the_works.views.view import VIEWS, ViewAll, ViewCreate, ViewUpdate, ViewDelete +from the_works.views.simple_view import VIEWS, ViewAll, ViewCreate, ViewUpdate, ViewDelete def create_app(config=None): @@ -27,7 +27,7 @@ def create_app(config=None): init_db(app) # add url rules for class-based views - for m in CLASSVIEWABLE_MODELS: + for m in SIMPLE_MODELS: for v in VIEWS: route = f"/{m["name"]}/{v['name']}{v.get('route_params', '')}" class_ = globals()[f"View{v['name'].capitalize()}"] diff --git a/the_works/models.py b/the_works/models.py index 4eb2740..f87945c 100644 --- a/the_works/models.py +++ b/the_works/models.py @@ -6,7 +6,7 @@ from sqlalchemy.ext.associationproxy import AssociationProxy, association_proxy from flask import url_for -CLASSVIEWABLE_MODELS = [ +SIMPLE_MODELS = [ {"name": "genre", "title": "Genres"}, {"name": "herausgeber", "title": "Herausgeber", "column": "Name"}, {"name": "pseudonym", "title": "Pseudonyme"}, diff --git a/the_works/views/view.py b/the_works/views/simple_view.py similarity index 92% rename from the_works/views/view.py rename to the_works/views/simple_view.py index dcd17b1..40dacba 100644 --- a/the_works/views/view.py +++ b/the_works/views/simple_view.py @@ -28,7 +28,7 @@ class ViewBase(View, ABC): class ViewAll(ViewBase): methods = ["GET"] def dispatch_request(self): - return render_template(f"views/classviewable.html", items=db.session.scalars(select(self.class_)), title=self.title, model=self.model, column=self.column) + return render_template(f"views/simple_view.html", items=db.session.scalars(select(self.class_)), title=self.title, model=self.model, column=self.column) class ViewCreate(ViewBase):