Questions tagged [django-fsm]
18 questions
4
votes
2 answers
Does django-fsm call save() method after state changed?
I am using django_fsm to manage state in my model. My model looks like:
from django.db import models,
from django_fsm import FSMField, transition
class MyModel(models.Model):
STATES = (
('pending', _('Pending')),
('active',…

Ivan Hreskiv
- 1,045
- 1
- 11
- 18
4
votes
1 answer
django-fsm: Permissions not raising exception
I've got source and target rule-based transition decorators working well in django-fsm (Finite State Machine). Now I'm trying to add permissions handling. This seems straightforward, but it seems that no matter what I do, the transition is executed,…

shacker
- 14,712
- 8
- 89
- 89
3
votes
0 answers
How to create a finite state machine with a dynamic number of steps
I have a simple linear workflow where a single task will have a list of approvers that it must pass through (linearly, each in turn) for confirmation before being completed.
I have designed this to use the User model for approver, with 2 additional…

alias51
- 8,178
- 22
- 94
- 166
2
votes
1 answer
Why can't I use @staticmethod here?
I'm using django-fsm to implement a state machine. The code looks like
def user_ok_to_check_me( instance, user):
...
class Job( models.Model):
# ... many screenfulls of code
@transition( field=state, target=BOOKING, source=CHECKING,…

nigel222
- 7,582
- 1
- 14
- 22
2
votes
0 answers
Recording temporarily to permanently
I am working on a workflow to create an order. Here is what I got so far
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django_fsm import FSMField, transition
from ev5.core.models import…

dave
- 93
- 2
- 10
1
vote
1 answer
Using django-fsm to determine the state of an object
How do I get the current state of a database item using django-fsm.
I have tried get_state() but it returns a null value.
Here is my code:
from django.db import models
from django_fsm import FSMField, transition
STATES = ("Open", "In Progress",…

Allan Maina
- 123
- 1
- 6
1
vote
0 answers
How to implement a class based view when using django- finite state machine in django
I am making a leave process where an applicant will apply for leave and the leave will be queued so that the approver will either approve or reject the leave application. I came across django-fsm and drf-fsm-transitions and I thought of implementing…

Philip Mutua
- 6,016
- 12
- 41
- 84
1
vote
2 answers
Django managing state of a parent model, based on "child models" (models that have a fk to the parent model)
Designing a a system which needs state transitions of a model which are based on transitions of other models.
I'm using Django FSM
Example:
class Foo(models.Model):
baz = models.Charfield()
state = FSMField(default='new')
class…

at14
- 1,194
- 9
- 16
0
votes
0 answers
django-fsm: dynamically-generated value based upon model instance in the custom properties for transition decorator
I'm incorporating django-fsm into a Django project containing a model that will include a number of state transitions, like so:
from django_fsm import FSMField, transition
class Record(models.Model):
state = FSMField(default='new')
…

ropable
- 1,547
- 1
- 19
- 31
0
votes
1 answer
How to make user inactive if not active for 1 day using django fsm
Need to change user status to inactive if not active for 1 day using django fsm library
class UserValidity(models.Model):
state = FSMField(default="active")
name = models.CharField(max_length=10)
date =…

TMD
- 1
- 1
0
votes
1 answer
How to define dynamic parallel entries in finite state machine - python django
Below is my code a.py
class Order(models.Model):
STATUS_STARTED = 0
STATUS_SLOW =1
STATUS_FAST=2
STATUS_JUMP=3
STATUS_CHOICES = (
(STATUS_STARTED, 'STARTED'),
(STATUS_SLOW,'SLOW')
(STATUS_FAST,'FAST')
(STATUS_JUMP,'JUMP')
)
product =…

T.D. Nathan
- 59
- 7
0
votes
1 answer
How to define a variable to check the previous transition in python django finite state machine
Below is my code a.py:
from django.db import models
from django_fsm import transition, FSMIntegerField
from django_fsm import FSMField, transition
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
import…

T.D. Nathan
- 59
- 7
0
votes
1 answer
How to change/ insert the djnago finite state machines on fly from terminal window
I have below a.py djnago finite state machine program:
from django.db import models
from django_fsm import transition,
FSMIntegerField
from django_fsm import FSMField, transition
import…

T.D. Nathan
- 59
- 7
0
votes
2 answers
How to run Django FSM first project
I have below django-program--- walk.py
from django.db import models
from django_fsm import transition, FSMIntegerField
from django_fsm import FSMField, transition
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE",…

T.D. Nathan
- 59
- 7
0
votes
1 answer
state transition error in django-fsm and resetting the current state to default
I have an Order model which has a field status which has choices -> NEW (default), PENDING(PDG), DISPATCHED(DSP), COMPLETED(CMP), CANCELLED(CLD)
models.py
class Order(Address, TimeStampedUUIDModel):
status = FSMField(
max_length=25,
…

Encrypto123
- 129
- 3
- 9