Exemple #1
0
def reset_clipboard(request):
    tenant_name = get_tenant_name()
    clipboard_id = "{}.{}.clipboard.node_ids".format(
        tenant_name,
        request.user.id
    )
    request.session[clipboard_id] = []
def get_clipboard(request):
    tenant_name = get_tenant_name()
    clipboard_id = "{}.{}.clipboard.node_ids".format(tenant_name,
                                                     request.user.id)
    if request.session.get(clipboard_id, False):
        return request.session[clipboard_id]

    return []
def get_from_clipboard(request):
    """
    It would be nice to have something like
    request.clipboard though... but
    this implementation will be post poned for later.
    """

    tenant_name = get_tenant_name()
    clipboard_id = "{}.{}.clipboard.node_ids".format(tenant_name,
                                                     request.user.id)
    return request.session.get(clipboard_id, [])
def copy_to_clipboard(request, node_ids):
    """
    It would be nice to have something like
    request.clipboard.add(node_ids) though... but
    this implementation will be post poned for later.
    """

    tenant_name = get_tenant_name()
    clipboard_id = "{}.{}.clipboard.node_ids".format(tenant_name,
                                                     request.user.id)
    request.session[clipboard_id] = node_ids