Setup of documents view

This commit is contained in:
Josako
2024-05-05 20:21:44 +02:00
parent 31250443c2
commit d925477e68
14 changed files with 467 additions and 61 deletions

View File

@@ -1,7 +1,7 @@
# from . import user_bp
import uuid
from datetime import datetime as dt, timezone as tz
from flask import request, redirect, url_for, flash, render_template, Blueprint, session
from flask import request, redirect, url_for, flash, render_template, Blueprint, session, current_app
from flask_security import hash_password, roles_required, roles_accepted
from ..models.user import User, Tenant, Role
@@ -83,9 +83,12 @@ def tenant():
# Create schema for new tenant
if error is None:
current_app.logger.info(f"Successfully created tenant {new_tenant.id} in Database")
current_app.logger.info(f"Creating schema for tenant {new_tenant.id}")
Database(new_tenant.id).create_tenant_schema()
flash(error) if error else flash('Tenant added successfully.')
else:
current_app.logger.error(f"Error creating tenant: {error}")
flash(error) if error else flash('Tenant added successfully.')
form = TenantForm()
return render_template('user/tenant.html', form=form)