Flow InheritanceΒΆ

Flow inheritance allows to override and add additional transitions to a new class.

To keep same state changes but with additional code, use State.super() decorator. To get access to undecorated base method use .original attribute

class MyFlow(object):
    state_field = fsm.State(States, default=States.NEW)

    @state_field.transition(source=States.DONE, target=States.HIDDEN)
    def hide():
        print('base hide')

class GuestFlow(MyFlow):
    @MyFlow.state_field.super()
    def hide(self):
        # any additional code here
        super().hide.original()