fixed two bugs after renaming files
This commit is contained in:
parent
f4b0ec6045
commit
0e3ae04e0c
@ -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()}"]
|
||||
|
||||
@ -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"},
|
||||
|
||||
@ -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):
|
||||
Loading…
Reference in New Issue
Block a user