A mico-framework for collecting lightweight, non-crypto "signatures" for virtually anything.
Signoff- a permitted user agrees to something at a time.Approval- a set ofSignoffsthat trigger a state change when theSigningOrderis complete.Approval Process- a sequence ofApprovalsthat drive a Finite State Machine.
-
Install the
django-signoffspackage from PyPI$ pip install django-signoffs
-
Add
signoffstoINSTALLED_APPS:INSTALLED_APPS = [ ..., "signoffs", ..., ]
django-signoffs has 3 tiers. Import and use only the features you need...
A Signoff records that a user agreed to some statement at a time.
signoffs.signoffs provides a framework for defining use-cases
that fall within this broad requirement.
Core features:
AbstractSignetandAbstractRevokedSignetModels (persistence layer)- Base
SignoffTypes, with injectable business and presentation logic...SignoffLogic(permissions and buisness logic)SignoffFormsManagerandSignoffRenderer(presentation layer)SignoffUrlsManager(custom end-points)
- Signoff "forward" relation:
SignoffOneToOneField - Signoff "reverse" relation Manager:
SignoffSet(many-to-one) - Declarative signing order automation:
SigningOrder - Template tag:
{% render_signoff my_signoff %}
An Approval records whether some condition was met at some point in time.
Essentially, it is a 2-state machine, designed to change states
when one or more Signoffs are completed, in some defined SigningOrder.
Core features:
AbstractApprovalSignetandAbstractApprovalStampModels (persistence layer)- Base
ApprovalTypes, with injectable business and presentation logic...ApprovalLogic(business logic)ApprovalStatusandApprovalRenderer(presentation layer)ApprovalUrlsManager(custom end-points)
- Approval "forward" relation:
ApprovalOneToOneField - Approval "reverse" relation Manager:
ApprovalSet(experimental) - Template tag:
{% render_approval my_approval %}
An ApprovalsProcess defines a sequence of Approvals and the state changes and/or
side effects triggered by approving or revoking each of them.
Core Features:
ApprovalsProcess(a basic linear sequence ofApprovals)FsmApprovalsProcess(state-changes and sequencing defined bydjango-fsm)
Signoffs core defines only abstract models, no migrations.
signoffs.contrib.signets provide concrete models that cover the basic use-cases. To opt-in, you must:
INSTALLED_APPS = [
...,
"signoffs.contrib.signets",
...,
] $ python manage.py migrate signoffs_signetsCore Features:
- Concrete Models:
Signet, andRevokedSignetprovide persistence layer for - Concrete Signoffs:
SimpleSignoff,RevokableSignoff, andIrrevokableSignoff
Approvals core defines only abstract models, no migrations.
signoffs.contrib.approvals provide concrete models with basic relations. To opt-in you must:
INSTALLED_APPS = [
...,
"signoffs.contrib.approvals",
...,
] $ python manage.py migrate signoffs_approvalsCore Features:
- Concrete Models:
ApprovalSignet, andRevokedApprovalSignetdefine a FK relation to... Stampwhich provides persistence layer for...SimpleApprovalandIrrevokableApproval, which play nicely with...ApprovalSignoff, which uses the Concrete Models for persistence.
Signoffs is integrated with django-fsm, allowing approval processes to drive a finite state machine. To opt-in:
$ pip install django-signoffs[fsm]pip install -e git+https://github.com/powderflask/django-signoffs.git#egg=django-signoffspython django-signoffs/manage.py install_demopython django-signoffs/manage.py runserver
Special thanks to BC Hydro, Chartwell, and all Contributors
Without django and the django dev team, the universe would have fewer rainbows and ponies.
Signoffs approval process can be integrated on the deceptively clever django_fsm Friendly Finite State Machine.
Signoffs uses a global registry as store for singleton code objects - thanks persisting_theory!
This package was originally created with cookiecutter and the cookiecutter-pypackage project template.
$ pip install -r reqirements_dev.txt$ pytestor
$ tox$ isort
$ black
$ flake8- Semantic Versioning
$ bumpver show
- invoke
$ invoke -l
- GitHub Actions (see .github/workflows)
- GitHub Webhooks (see settings/hooks)