Improvements to user views and forms + correction of schema creation for new tenants.

This commit is contained in:
Josako
2024-06-03 13:24:13 +02:00
parent fcc0caeb09
commit c660c35de4
5 changed files with 73 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ class Database:
# you can store it in a different table in public schema and use it from there
# may be a faster approach
# last_revision = heads(directory="migrations/tenant", verbose=True, resolve_dependencies=False)
last_revision = popen(".venv/bin/flask db heads -d migrations/tenant").read()
last_revision = popen("scripts/db_heads.sh -d migrations/tenant").read()
print("LAST REVISION")
print(last_revision)
last_revision = last_revision.splitlines()[-1].split(" ")[0]

View File

@@ -1,3 +1,6 @@
from flask import flash
def prepare_table(model_objects, column_names):
"""
Converts a list of SQLAlchemy model objects into a list of dictionaries based on specified column names.
@@ -34,3 +37,10 @@ def prepare_table_for_macro(model_objects, column_attrs):
]
for obj in model_objects
]
def form_validation_failed(request, form):
if request.method == 'POST':
for fieldName, errorMessages in form.errors.items():
for err in errorMessages:
flash(f"Error in {fieldName}: {err}", 'danger')