Skip to main content

django-model-fsm

A package to use transitions with a Django model.

Usage

from django.db import models

from django_model_fsm.dataclasses import StateData, TriggerData, WorkflowData
from django_model_fsm.models import TransitionsMixin

# States
# fmt: off
S_CREATED = StateData(
    id="created",
    label="Created",
)
S_PUBLISHED = StateData(
    id="published",
    label="Published",
)
S_ARCHIVED = StateData(
    id="archived",
    label="Archived",
)
# fmt: on

# Triggers
# fmt: off
T_PUBLISHED_CHALLENGE_MODEL = TriggerData(
    id="published_challenge_model",
    label="Publish",
    order=150,
    need_confirmation=False,
)
T_UNPUBLISHED_CHALLENGE_MODEL = TriggerData(
    id="unpublished_challenge_model",
    label="Unpublish",
    order=175,
    need_confirmation=True,
)
T_ARCHIVE_CHALLENGE_MODEL = TriggerData(
    id="archive_challenge_model",
    label="Archive",
    order=350,
    need_confirmation=True,
)
# fmt: on

challenge_model_workflow = WorkflowData(
    initial_state=S_CREATED,
    transitions_data=[
        # fmt: off
        {"trigger": T_PUBLISHED_CHALLENGE_MODEL, "source": S_CREATED, "dest": S_PUBLISHED},
        {"trigger": T_UNPUBLISHED_CHALLENGE_MODEL, "source": S_PUBLISHED, "dest": S_CREATED},
        {"trigger": T_ARCHIVE_CHALLENGE_MODEL, "source": S_PUBLISHED, "dest": S_ARCHIVED},
        # fmt: on
    ],
)


class MyModel(models.Model, TransitionsMixin):
    workflow_data = challenge_model_workflow
    workflow_callbacks = []

Metadata

Release files for django-model-fsm 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-model-fsm 0.2.7
File Size Uploaded Provenance Actions
django_model_fsm-0.2.7.tar.gz 7.4 kB Without provenance Details for django_model_fsm-0.2.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-model-fsm 0.2.7
File Interpreter ABI Platform Actions
django_model_fsm-0.2.7-py3-none-any.whl Python 3 none any Details for django_model_fsm-0.2.7-py3-none-any.whl

Total release size: 23.0 kB

Release files / django_model_fsm-0.2.7.tar.gz

Download URL django_model_fsm-0.2.7.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
000be30456e83b8ceed9faa866ceec96078c433ae880932cd9768bfb83772a54
BLAKE2b-256 checksum
How to use checksums
24f8e4fd19232caddcbc786577c67abd803c15a9ff5b1ee4cf94439322e86dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Release files / django_model_fsm-0.2.7-py3-none-any.whl

Download URL django_model_fsm-0.2.7-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4dff32d8fa50a204aeb87aa16c591aece6cf5fe3d3b184ba311b6ec6f221915f
BLAKE2b-256 checksum
How to use checksums
ebd28e38fa681a35177926c5aba150ca7e0e4aaf2225a1bf26685ad077465ffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.15

Security for django-model-fsm 0.2.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page