(request, workspace=None)
return render(request, template_name, context)
Edit dashboard.

    :param django.http.HttpRequest request:
    :param string workspace: Workspace slug. If given, the workspace loaded.
        Otherwise we deal with no workspace.
    :return django.http.HttpResponse:
Edit dashboard.
Edit dashboard .
def edit_dashboard(request, workspace=None):
    """Edit dashboard.

    :param django.http.HttpRequest request:
    :param string workspace: Workspace slug. If given, the workspace loaded.
        Otherwise we deal with no workspace.
    :return django.http.HttpResponse:
    """
    # Getting the list of plugins that user is allowed to use.
    registered_plugins = get_user_plugins(request.user)
    user_plugin_uids = [uid for uid, _repr in registered_plugins]

    # Getting dashboard settings for the user. Then get users' layout.
    dashboard_settings = get_or_create_dashboard_settings(request.user)

    workspaces = get_workspaces(
        request.user,
        dashboard_settings.layout_uid,
        workspace,
        different_layouts=dashboard_settings.allow_different_layouts
    )

    layout = get_layout(
        layout_uid=(
            workspaces['current_workspace'].layout_uid
            if workspaces['current_workspace']
            else dashboard_settings.layout_uid
        ),
        as_instance=True
    )

    # If workspace with slug given is not found in the list of workspaces
    # redirect to the default dashboard.
    if workspaces['current_workspace_not_found']:
        messages.info(
            request,
            _('The workspace with slug "{0}" does '
              'not belong to layout "{1}".').format(workspace, layout.name)
            )
        return redirect('dash.edit_dashboard')

    # Getting the (frozen) queryset.
    dashboard_entries = DashboardEntry._default_manager.get_for_user(
        user=request.user,
        layout_uid=layout.uid,
        workspace=workspace
    ).select_related(
        'workspace',
        'user'
    ).filter(
        plugin_uid__in=user_plugin_uids
    ).order_by(
        'placeholder_uid',
        'position'
    )[:]

    placeholders = layout.get_placeholder_instances(
        dashboard_entries,
        workspace=workspace,
        request=request
    )

    layout.collect_widget_media(dashboard_entries)

    context = {
        'placeholders': placeholders,
        'placeholders_dict': iterable_to_dict(
            placeholders,
            key_attr_name='uid'
        ),
        'css': layout.get_css(placeholders),
        'layout': layout,
        'edit_mode': True,
        'dashboard_settings': dashboard_settings,
    }

    context.update(workspaces)

    context.update(
        {'public_dashboard_url': get_public_dashboard_url(dashboard_settings)}
    )

    template_name = layout.get_edit_template_name(request)

    return render(request, template_name, context)
def edit_dashboard ( request , workspace = None ) : # Getting the list of plugins that user is allowed to use. registered_plugins = get_user_plugins ( request . user ) user_plugin_uids = [ uid for uid , _repr in registered_plugins ] # Getting dashboard settings for the user. Then get users' layout. dashboard_settings = get_or_create_dashboard_settings ( request . user ) workspaces = get_workspaces ( request . user , dashboard_settings . layout_uid , workspace , different_layouts = dashboard_settings . allow_different_layouts ) layout = get_layout ( layout_uid = ( workspaces [ 'current_workspace' ] . layout_uid if workspaces [ 'current_workspace' ] else dashboard_settings . layout_uid ) , as_instance = True ) # If workspace with slug given is not found in the list of workspaces # redirect to the default dashboard. if workspaces [ 'current_workspace_not_found' ] : messages . info ( request , _ ( 'The workspace with slug "{0}" does ' 'not belong to layout "{1}".' ) . format ( workspace , layout . name ) ) return redirect ( 'dash.edit_dashboard' ) # Getting the (frozen) queryset. dashboard_entries = DashboardEntry . _default_manager . get_for_user ( user = request . user , layout_uid = layout . uid , workspace = workspace ) . select_related ( 'workspace' , 'user' ) . filter ( plugin_uid__in = user_plugin_uids ) . order_by ( 'placeholder_uid' , 'position' ) [ : ] placeholders = layout . get_placeholder_instances ( dashboard_entries , workspace = workspace , request = request ) layout . collect_widget_media ( dashboard_entries ) context = { 'placeholders' : placeholders , 'placeholders_dict' : iterable_to_dict ( placeholders , key_attr_name = 'uid' ) , 'css' : layout . get_css ( placeholders ) , 'layout' : layout , 'edit_mode' : True , 'dashboard_settings' : dashboard_settings , } context . update ( workspaces ) context . update ( { 'public_dashboard_url' : get_public_dashboard_url ( dashboard_settings ) } ) template_name = layout . get_edit_template_name ( request ) return render ( request , template_name , context )