LeafletMap

Below is an example configuration of a panel using the LeafletMap module:

{
    "full_row": True,
    "title": "World Map",
    "url_name": "frame_leaflet_map",
    "url_action_name": "panel_edb_map",
    "type": "Map",
    "width": 12,
    "height": 500,
    "content": {
        "view": custom_views.LeafletMapEdb,
        "view_params": {
            "model": custom_models.EdbCalculation,
            "order_by": "supplier__location__country_code_a2",
        },
        "url_params_list": [
            None,
            {"category": "str"},
        ],
    },
    "footer": {
        "select_name": "category",
        "select_values": {
            "self": "Total Risk Exposure Score",
            "social_and_labor": "Social & Labor Score",
            "health_and_safety": "Health & Safety Score",
            "environment": "Environment Score",
        },
        "col_classes": "col-md-6 col-sm-6 col-xs-6",
    },
},

The view_params are:

  • model the model this map is showing

  • order_by the field in the model

The custom_views can be defined as followed:

Function get_marker_map can have all of the information about the supplier and show them on the map.

Last updated