From 53283b6687bead270753cf207ba447f0b4bcc02b Mon Sep 17 00:00:00 2001 From: Josako Date: Thu, 21 Aug 2025 07:38:25 +0200 Subject: [PATCH] - bug TRA-67 solved by re-introducing a 2-step process. Dynamic Attributes cannot be added to a non-existing, newly created object, it seems. --- eveai_app/views/user_views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/eveai_app/views/user_views.py b/eveai_app/views/user_views.py index 0f822db..0486ab4 100644 --- a/eveai_app/views/user_views.py +++ b/eveai_app/views/user_views.py @@ -572,15 +572,12 @@ def tenant_make(): form = TenantMakeForm() customisation_config = cache_manager.customisations_config_cache.get_config("CHAT_CLIENT_CUSTOMISATION") default_customisation_options = create_default_config_from_type_config(customisation_config["configuration"]) - form.add_dynamic_fields("configuration", customisation_config, default_customisation_options) if form.validate_on_submit(): tenant_id = session['tenant']['id'] new_tenant_make = TenantMake() form.populate_obj(new_tenant_make) new_tenant_make.tenant_id = tenant_id - customisation_options = form.get_dynamic_data("configuration") - new_tenant_make.chat_customisation_options = json.dumps(customisation_options) # Verwerk allowed_languages als array new_tenant_make.allowed_languages = form.allowed_languages.data if form.allowed_languages.data else None set_logging_information(new_tenant_make, dt.now(tz.utc)) @@ -589,9 +586,10 @@ def tenant_make(): db.session.add(new_tenant_make) db.session.commit() flash('Tenant Make successfully added!', 'success') - current_app.logger.info(f'Tenant Make {new_tenant_make.name} successfully added for tenant {tenant_id}!') + current_app.logger.info(f'Tenant Make {new_tenant_make.name}, id {new_tenant_make.id} successfully added ' + f'for tenant {tenant_id}!') # Enable step 2 of creation of retriever - add configuration of the retriever (dependent on type) - return redirect(prefixed_url_for('user_bp.tenant_makes', tenant_make_id=new_tenant_make.id)) + return redirect(prefixed_url_for('user_bp.edit_tenant_make', tenant_make_id=new_tenant_make.id)) except SQLAlchemyError as e: db.session.rollback() flash(f'Failed to add Tenant Make. Error: {e}', 'danger')