Card
Below is an example configuration of a panel using the Card module:
{
"title": "Supplier Information",
"full_row": True,
"url_name": "frame_board",
"url_action_name": "panel_supplierparent_card",
"width": 6,
"reload_div": True,
"content": {
"view": module_views.Board,
"url_params_list": [{"pk": "int"}],
"view_params": {
"model": custom_models.SupplierParent,
"limit": 1,
"cards_per_row": 1,
"url_name": "panel_supplierparent_card",
"board_wrapper": False,
"field_definitions": {
"footer_settings": {
"footer": True,
"allowed_user_groups": [
"Superuser",
],
},
"bg_class_mapping": {
"success": {"is_active": True},
"danger": {"is_active": False},
},
"heading_fields": {
"title_field_name": "name",
},
"group_items": [
{
"label": "Active",
"field_name": "is_active",
"format": "input",
"input_type": "dropdown",
"select_options": [
{"label": "Yes", "value": True},
{"label": "No", "value": False},
],
"mapping": {
True: "Yes",
False: "No",
},
"allowed_user_groups": [
"Superuser",
],
},
],
},
},
},
},
The view_params are:
model: The model shown in the card
url_name: Unique reference for the panel
field_definition:
footer_setting: Basic setting for the footer such as privilege
bg_class_setting: The setting of the background
success: The background is green when the field is True
danger: The background is red when the field is False
heading_field: The heading of the card
group_items:
label: The heading of the field in the card
field_name: The field in the model
format: The format of the input box
input: The input type
select_options: The option of the input
mapping: The mapping of the options
allowed_user_group: The user group who can see the content

Last updated