Getting Started

Customization refers to a series of actions that enable you to personalize your agent, data source, or collection.
An agent is an HTTP server that serves the Forest Admin front-end application. A data source is a database or an API that you want to connect to Forest Admin. A collection is a set of data that you want to manage in Forest Admin.
Among other things, you can modify your agent by incorporating data sources, using plugins, customizing collections, and adding charts. Additionally, you can personalize your data sources by offering choices that cater to all data source types. Lastly, you can adapt your collections by including actions, fields, relations, segments between the data sources and other functionalities.

Customizing collections

The available customizations are listed in the sections below.
Using them always starts with the same step: use the customize_collection method on the collection you want to customize.
It takes one argument: the collection name and returns the collection customizer.
from ....models import Base
from forestadmin.datasource_toolkit.decorators.computed.types import ComputedDefinition
agent.customize_collection("Task").register_computed("title", ComputedDefinition(
# field definition

Removing collections

You may want collections to be imported into your Forest Admin agent, but not exposed to the end-users. To do so, you can use the remove_collection method.
All relations to this collection will be removed as well, but the collection will still be available in the Forest Admin agent and can be used in your code
Using the include/exclude options of add_datasource ensures that a collection is not imported in the first place. In that case, it won't be available in your code.
agent = create_agent()
# Add your data source.
# Remove the 'task' collection from your user's admin-panel.
# You can still use the collection in your code
agent.customize_collection('task')# ...

Using Django

Because the apps must be correctly loaded before accessing any Django model, you need to set FOREST_CUSTOMIZE_FUNCTION setting to a function that will be called after agent creation when apps are loaded.
FOREST_CUSTOMIZE_FUNCTION = "my_app.forest_admin.customize_agent"
# or it can be a function directly
# from my_app.forest_admin import customize_agent
# FOREST_CUSTOMIZE_FUNCTION = my_app.forest_admin.customize_agent
from forestadmin.django_agent.agent import DjangoAgent
def customize_agent(agent: DjangoAgent):
# customizations here
# ...