(user, layout, placeholder, workspace=None)
return matrix
Build the cells matrix.

    :param django.contrib.auth.models.User user:
    :param dash.base.BaseDashboardLayout layout: Instance of
        subclassed ``dash.base.BaseDashboardLayout`` object.
    :param dash.base.BaseDashboardPlaceholder placeholder: Instance of
        subclassed ``dash.base.BaseDashboardPlaceholder`` object.
    :param string workspace: Workspace slug.
    :return list: List of cells occupied.
Build the cells matrix.
Build the cells matrix .
def build_cells_matrix(user, layout, placeholder, workspace=None):
    """Build the cells matrix.

    :param django.contrib.auth.models.User user:
    :param dash.base.BaseDashboardLayout layout: Instance of
        subclassed ``dash.base.BaseDashboardLayout`` object.
    :param dash.base.BaseDashboardPlaceholder placeholder: Instance of
        subclassed ``dash.base.BaseDashboardPlaceholder`` object.
    :param string workspace: Workspace slug.
    :return list: List of cells occupied.
    """
    assert isinstance(layout, BaseDashboardLayout)
    assert issubclass(placeholder, BaseDashboardPlaceholder)

    # Getting the list of plugins that user is allowed to use.
    registered_plugins = get_user_plugins(user)
    user_plugin_uids = [uid for uid, _repr in registered_plugins]

    # Getting the queryset for user and freezing it.
    dashboard_entries = DashboardEntry \
        ._default_manager \
        .get_for_user(
            user=user,
            layout_uid=layout.uid,
            workspace=workspace) \
        .select_related('workspace', 'user') \
        .filter(plugin_uid__in=user_plugin_uids) \
        .filter(placeholder_uid=placeholder.uid) \
        .order_by('placeholder_uid', 'position')[:]

    matrix = []
    for dashboard_entry in dashboard_entries:
        occupied_cells = get_occupied_cells(
            layout,
            placeholder,
            dashboard_entry.plugin_uid,
            dashboard_entry.position
        )
        if occupied_cells:
            matrix += occupied_cells
        # Now we should calculate how much space each widget occupies.

    return matrix
def build_cells_matrix ( user , layout , placeholder , workspace = None ) : assert isinstance ( layout , BaseDashboardLayout ) assert issubclass ( placeholder , BaseDashboardPlaceholder ) # Getting the list of plugins that user is allowed to use. registered_plugins = get_user_plugins ( user ) user_plugin_uids = [ uid for uid , _repr in registered_plugins ] # Getting the queryset for user and freezing it. dashboard_entries = DashboardEntry . _default_manager . get_for_user ( user = user , layout_uid = layout . uid , workspace = workspace ) . select_related ( 'workspace' , 'user' ) . filter ( plugin_uid__in = user_plugin_uids ) . filter ( placeholder_uid = placeholder . uid ) . order_by ( 'placeholder_uid' , 'position' ) [ : ] matrix = [ ] for dashboard_entry in dashboard_entries : occupied_cells = get_occupied_cells ( layout , placeholder , dashboard_entry . plugin_uid , dashboard_entry . position ) if occupied_cells : matrix += occupied_cells # Now we should calculate how much space each widget occupies. return matrix