Skip to content

Interfaces

IAdminPanel

Extends the functionallity of the Admin Panel.

after_config_update(schema_id, data_before_update, data)

Called after generic view configuration update.

Could be used to perform additional actions after configuration update.

PARAMETER DESCRIPTION
schema_id

an arbitrary schema ID

data_before_update

a dictionary with configuration data before update

data

a dictionary with configuration data after update

Example
def after_config_update(schema_id, data_before_update, data):
    if schema_id == 'my_schema':
        do_something()

before_config_update(schema_id, data)

Called before generic view configuration update.

Could be used to modify configuration data before it is saved.

PARAMETER DESCRIPTION
schema_id

an arbitrary schema ID

data

a dictionary with configuration data

Example
def before_config_update(schema_id, data):
    if schema_id == 'my_schema':
        data['my_field'] = 'my_value'

get_col_renderers()

Allows an extension to register its own col renderers.

Example
def get_col_renderers():
    return {'col_counter': col_counter}
RETURNS DESCRIPTION
dict[str, ColRenderer]

A mapping of renderer names to renderer functions

register_toolbar_button(toolbar_buttons_list)

Register toolbar buttons.

Extension will receive the list of toolbar button objects. It can modify the list and return it back.

Example
import ckanext.ap_main.types as ap_types

def register_toolbar_button(toolbar_buttons_list):
    toolbar_buttons_list.append(
        ap_types.ToolbarButton(
            label='My Button',
            url=tk.h.url_for('my_controller.my_action'),
            icon='fa-star',
            attributes={'class': 'text'},
        )
    )
    return toolbar_buttons_list
RETURNS DESCRIPTION
list[ToolbarButton]

A list of toolbar button objects