(request,
                   placeholder_uid,
                   workspace=None,
                   position=None,
                   template_name='dash/plugin_widgets.html',
                   template_name_ajax='dash/plugin_widgets_ajax.html')
return render(request, template_name, context)
Plugin widgets view.

    Lists all the widgets for the placeholder and workspace given.

    :param django.http.HttpRequest request:
    :param string placeholder_uid: Placeholder UID.
    :param mixed workspace:
    :param int position: Position on the dashboard to which the widget is to
        be added.
    :param string template_name:
    :param string template_name_ajax: Template used for AJAX requests.
    :return django.http.HttpResponse:
Plugin widgets view.
Plugin widgets view .
def plugin_widgets(request,
                   placeholder_uid,
                   workspace=None,
                   position=None,
                   template_name='dash/plugin_widgets.html',
                   template_name_ajax='dash/plugin_widgets_ajax.html'):
    """Plugin widgets view.

    Lists all the widgets for the placeholder and workspace given.

    :param django.http.HttpRequest request:
    :param string placeholder_uid: Placeholder UID.
    :param mixed workspace:
    :param int position: Position on the dashboard to which the widget is to
        be added.
    :param string template_name:
    :param string template_name_ajax: Template used for AJAX requests.
    :return django.http.HttpResponse:
    """
    # Getting dashboard settings for the user. Then get users' layout.
    dashboard_settings = get_or_create_dashboard_settings(request.user)
    layout = get_layout(
        layout_uid=dashboard_settings.layout_uid,
        as_instance=True
    )

    placeholder = layout.get_placeholder(placeholder_uid)

    if not validate_placeholder_uid(layout, placeholder_uid):
        raise Http404(
            gettext("Invalid placeholder: {0}").format(placeholder_uid)
        )

    occupied_cells = build_cells_matrix(
        request.user,
        layout,
        placeholder,
        workspace=workspace
    )

    # Here we checking if clipboard contains a plugin which is suitable for
    # being pasted into the cell given.
    paste_from_clipboard_url = None

    # First get the clipboard data.
    clipboard_plugin_data = get_plugin_data_from_clipboard(request, layout.uid)

    # If clipboard data is not empty, check if the data is suitable for
    # being pasted into the position given.
    if clipboard_plugin_data:
        can_paste_from_clipboard = can_paste_entry_from_clipboard(
            request=request,
            layout=layout,
            placeholder_uid=placeholder_uid,
            position=position,
            workspace=workspace
        )

        if can_paste_from_clipboard:
            kwargs = {
                'placeholder_uid': placeholder_uid,
                'position': position,
            }
            if workspace:
                kwargs.update({'workspace': workspace})

            paste_from_clipboard_url = reverse(
                'dash.paste_dashboard_entry',
                kwargs=kwargs
            )

    context = {
        'layout': layout,
        'grouped_widgets': get_widgets(
            layout,
            placeholder,
            request.user,
            workspace=workspace,
            position=position,
            occupied_cells=occupied_cells
        ),
        'dashboard_settings': dashboard_settings,
        'paste_from_clipboard_url': paste_from_clipboard_url,
    }

    if request.is_ajax():
        template_name = layout.plugin_widgets_template_name_ajax

    return render(request, template_name, context)
def plugin_widgets ( request , placeholder_uid , workspace = None , position = None , template_name = 'dash/plugin_widgets.html' , template_name_ajax = 'dash/plugin_widgets_ajax.html' ) : # Getting dashboard settings for the user. Then get users' layout. dashboard_settings = get_or_create_dashboard_settings ( request . user ) layout = get_layout ( layout_uid = dashboard_settings . layout_uid , as_instance = True ) placeholder = layout . get_placeholder ( placeholder_uid ) if not validate_placeholder_uid ( layout , placeholder_uid ) : raise Http404 ( gettext ( "Invalid placeholder: {0}" ) . format ( placeholder_uid ) ) occupied_cells = build_cells_matrix ( request . user , layout , placeholder , workspace = workspace ) # Here we checking if clipboard contains a plugin which is suitable for # being pasted into the cell given. paste_from_clipboard_url = None # First get the clipboard data. clipboard_plugin_data = get_plugin_data_from_clipboard ( request , layout . uid ) # If clipboard data is not empty, check if the data is suitable for # being pasted into the position given. if clipboard_plugin_data : can_paste_from_clipboard = can_paste_entry_from_clipboard ( request = request , layout = layout , placeholder_uid = placeholder_uid , position = position , workspace = workspace ) if can_paste_from_clipboard : kwargs = { 'placeholder_uid' : placeholder_uid , 'position' : position , } if workspace : kwargs . update ( { 'workspace' : workspace } ) paste_from_clipboard_url = reverse ( 'dash.paste_dashboard_entry' , kwargs = kwargs ) context = { 'layout' : layout , 'grouped_widgets' : get_widgets ( layout , placeholder , request . user , workspace = workspace , position = position , occupied_cells = occupied_cells ) , 'dashboard_settings' : dashboard_settings , 'paste_from_clipboard_url' : paste_from_clipboard_url , } if request . is_ajax ( ) : template_name = layout . plugin_widgets_template_name_ajax return render ( request , template_name , context )