Skip to main content

Clipboard middleware for Papermerge DMS

Project description

MgClipboard

Clipboard middleware for Papermerge DMS. Designed as Django reusable app.

Installation

Install it using pip::

pip install mgclipboard

Add app to INSTALLED_APPS in settings.py:

INSTALLED_APP = (
...
'mgclipboard',
...
)

Add it to MIDDLEWARE list:

MIDDLEWARE = [
    ...
    # AFTER
    # * django.contrib.sessions.middleware
    # * django.contrib.auth.middleware
    'mgclipboard.middleware.ClipboardMiddleware'
    ...
]

mgclipboard.middleware is dependent on django.contrib.sessions and django.contrib.auth middleware. Thus, dependencies must be included first in MIDDLEWARE list.

Usage

MgClipboard middleware adds 3 attributes to the request object:

  • request.clipboard
  • request.nodes (shortcut for request.clipboard.nodes)
  • request.pages (shortcut for request.clipboard.pages)

To add list of node ids to clipboard use:

request.nodes.add(['id1', 'id2', ...])

To retrieve all node ids (folder or documents) currently in the clipboard call:

request.nodes.all()

To clear all nodes data from the clipboard:

request.nodes.clear()

To add pages, all belonging to same document, use:

request.pages.add(
    doc_id=doc_id,
    page_nums=[1, 2, 3]
)

Important! page_nums is a list of page numbers within document doc_id. Page numbering starts with 1.

All pages currently in clipboard are returned by:

request.pages.all()

To clear all pages data from the clipboard:

request.pages.clear()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mgclipboard-0.3.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file mgclipboard-0.3.0.tar.gz.

File metadata

  • Download URL: mgclipboard-0.3.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.8

File hashes

Hashes for mgclipboard-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1da1a39b3745e75462ea200835371de3b20b33681acef22daf4117806ad0c3aa
MD5 ecc957ca21566f0ab80ce9c916680fc2
BLAKE2b-256 feec5c72f894801b1648a22dd6c734f7d6cb428d9a024e459f89ae0dfe0d0a33

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page