Skip to main content

Simple ticketing and workflow engine based on django-fsm-2

Project description

Introduction

django_fsm_ticket is a customizable workflow and ticketing framework, built on top of django-fsm-2.

The goal of django-fsm-ticket is to provide a low-code tool for creating web applications to manage workflows in Django. The user interface (i.e., Django views) is automatically generated by the framework, using the familiar metaphor of "tickets" (similar to GitHub's issues). The developer can fully customize:

  • Data involved in a ticket life cycle by defining plain Django models.
  • How data is shown within the ticket by defining Django templates.
  • The workflow itself (ticket states, state transitions, user permissions, ticket visibility), relying on the simple and rock-solid django-fsm-2 library.

Ticket list

Ticket list page, with the Bootstrap Italia theme

A workflow instance is a ticket

You can think of django-fsm-ticket as a blend of a workflow system and a GitHub-like ticketing system. Each workflow instance is a ticket, with a current state and some ticket-related data.

Each ticket is visualized on a single web page, along with its history. Like comments in GitHub, ticket history is a sequence of ticket updates, showing how the ticket changed over time. Usually, a ticket update is the result of an action performed by an authorized user, but updates can also be triggered programmatically. Each ticket update may change the current ticket state and data; a ticket update may also hold data related to the update itself, such as a comment, some uploaded files, or any other piece of information that you may wish to store in a Django model instance.

A ticket's behavior is defined through Django models:

  • To define the shape of tickets, you can subclass the Ticket class (or you may just use the base class Ticket, which provides the bare minimum ticket data, i.e., a title, opening time, current state, the user that opened the ticket, etc.)
  • For each kind of ticket update (you may have several of them, corresponding to different kinds of actions that users may perform), you may define a subclass of TicketUpdate; or you may use the base class, which provides the bare minimum fields for an update, such as the update author, a timestamp, and optional notes.

Ticket list

Details page of a ticket

Users perform actions

Users perform actions. An action has a name (e.g., "add a comment", "close the ticket", "approve the request") and causes a ticket update. Thus, an action may:

  • Change the ticket state.
  • Alter ticket data.
  • Create a TicketUpdate instance, with data related to the performed action.
  • Execute arbitrary Python code.

The set of actions that are currently allowed depends on the current Ticket state and the currently logged-in user. They are defined through a finite state machine.

django_fsm_ticket takes care of automatically generating a fully-working UI from your definitions of Ticket and TicketUpdate subclasses. It displays the proper forms and actions. You can fully customize the templates, models, and views if you wish.

Getting started

Installation

Install the library from PyPI:

pip install django-fsm-ticket

If you also plan to expose a REST API for the ticketing system, include the [api] extra:

pip install django-fsm-ticket[api]

In settings.py, add polymorphic and django_fsm_ticket to your INSTALLED_APPS list:

# settings.py

INSTALLED_APPS = [
  # ...
  "polymorphic",
  "django_fsm_ticket",
  # ...
]

Also, in settings.py, add a configuration class:

# settings.py

class FSM_TICKET_CONFIG:
    URL_PREFIX = "https://my.fsm.tickets.com"
    NOTIFICATION_LEVEL = 2

Here, we are specifying the base url and telling django_fsm_ticket to send email notifications to users in charge of taking actions on tickets unless they opted-out from email notifications.

You may want to be able to configure django_fsm_ticket via the Django admin interface by using django-constance, as discussed in the tutorial.

Finally, in your project-level urls.py file, add a urlconf for django-fsm-ticket:

# urls.py

from django.urls import path, include

# ...

urlpatterns = [
    # ...
    path("ticket/", include('django_fsm_ticket.urls')),
    # ...
]

Tutorial

New to django-fsm-ticket? We recommend starting with our beginner-friendly tutorial:

👉 Read the docs/TUTORIAL.md

Example project

If you'd like to explore a fully working example, we offer a demo Django project.

You can run the project locally by cloning the repository and executing the following commands:

# Make sure poetry is installed
pip install --user poetry

poetry install --extras "dev"
eval "$(poetry env activate)"
# or, if you use `fish`:
# eval (poetry env activate)

cd example_project

# Setup database
python manage.py migrate
python manage.py createsuperuser

# Start server
python manage.py runserver

Contributing

Want to contribute or submit improvements?

👉 Read the CONTRIBUTING.md

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

django_fsm_ticket-1.4.0.post1.tar.gz (47.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_fsm_ticket-1.4.0.post1-py3-none-any.whl (61.1 kB view details)

Uploaded Python 3

File details

Details for the file django_fsm_ticket-1.4.0.post1.tar.gz.

File metadata

  • Download URL: django_fsm_ticket-1.4.0.post1.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.12.13 Linux/6.17.0-1013-azure

File hashes

Hashes for django_fsm_ticket-1.4.0.post1.tar.gz
Algorithm Hash digest
SHA256 abf6b7761a7726293b62b197d4d54e296923a6bde3cdc325f2a25777483e2f0d
MD5 53c6168fff88d9c2f127095293028b19
BLAKE2b-256 43c5344a9560543377ce3ede0fd3eb395244ab60fe188f07ac879dfd79593c8d

See more details on using hashes here.

File details

Details for the file django_fsm_ticket-1.4.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_fsm_ticket-1.4.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe4423faec4836e564fd17165141586c09a1f3bada90bffd5c4851b34147465d
MD5 83c67ee2820306e77db39c5cd0c4bb12
BLAKE2b-256 81d7c2babb3af7b5e12f0b332b8e2bafc4895428166dffe1820bb69be8f6a968

See more details on using hashes here.

Supported by

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