fixed two bugs after renaming files

This commit is contained in:
eclipse 2025-07-28 22:48:56 +02:00
parent f4b0ec6045
commit 0e3ae04e0c
3 changed files with 5 additions and 5 deletions

View File

@ -1,9 +1,9 @@
from flask import Flask from flask import Flask
import dotenv # this import is not strictly necessary but it forces pipreqs-to include dotenv when generating `requirements.txt` 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.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 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): def create_app(config=None):
@ -27,7 +27,7 @@ def create_app(config=None):
init_db(app) init_db(app)
# add url rules for class-based views # add url rules for class-based views
for m in CLASSVIEWABLE_MODELS: for m in SIMPLE_MODELS:
for v in VIEWS: for v in VIEWS:
route = f"/{m["name"]}/{v['name']}{v.get('route_params', '')}" route = f"/{m["name"]}/{v['name']}{v.get('route_params', '')}"
class_ = globals()[f"View{v['name'].capitalize()}"] class_ = globals()[f"View{v['name'].capitalize()}"]

View File

@ -6,7 +6,7 @@ from sqlalchemy.ext.associationproxy import AssociationProxy, association_proxy
from flask import url_for from flask import url_for
CLASSVIEWABLE_MODELS = [ SIMPLE_MODELS = [
{"name": "genre", "title": "Genres"}, {"name": "genre", "title": "Genres"},
{"name": "herausgeber", "title": "Herausgeber", "column": "Name"}, {"name": "herausgeber", "title": "Herausgeber", "column": "Name"},
{"name": "pseudonym", "title": "Pseudonyme"}, {"name": "pseudonym", "title": "Pseudonyme"},

View File

@ -28,7 +28,7 @@ class ViewBase(View, ABC):
class ViewAll(ViewBase): class ViewAll(ViewBase):
methods = ["GET"] methods = ["GET"]
def dispatch_request(self): 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): class ViewCreate(ViewBase):