Naming conflicts

This is the official documentation of the forestadmin-agent-django and forestadmin-agent-flask Python agents.

When importing collections to an admin panel, you may encounter naming collisions.

You can tackle them by renaming the collection that is causing issues.

There are two ways to rename collections: either provide a plain object which maps the old names to the new names, or a function which does the same.

Don't worry about leaving naming collisions: your development agent will warn you and crash at startup.

from flask_sqlalchemy import SQLAlchemy
from forestadmin.datasource_sqlalchemy.datasource import SqlAlchemyDatasource

db = SQLAlchemy()
with app.app_context():
    db.init_app(app)
    agent.add_datasource(SqlAlchemyDatasource(db), {
        "rename": {
            "Customer": "CustomerFromSQLAlchemy",
            "Store": "StoreFromSQLAlchemy",
        }
    })

Last updated