Ejemplo n.º 1
0
    def __init__(self, name, initial_state, states):
        self._name = name
        self._initial_state = initial_state
        self._states = states

        # Create a new django_xworkflows.models.Workflow subclass,
        # using the provided fields.
        workflow_class = base.WorkflowMeta(
            self._name,
            (Workflow, ),
            {
                'states': [(st, st) for st in states],
                'initial_state': initial_state,
            },
        )
        self._workflow_class = workflow_class
        self._workflow = workflow_class()
Ejemplo n.º 2
0
    def __init__(self, name, initial_state, states):
        self._name = name
        self._initial_state = initial_state
        self._states = states

        # Create a new django_xworkflows.models.Workflow subclass,
        # using the provided fields.
        workflow_class = base.WorkflowMeta(
            # When constructing from django.db.migrations, we might get a unicode instead of a str for the name;
            # this breaks calls to super()
            str(self._name),
            (Workflow, ),
            {
                'states': [(st, st) for st in states],
                'initial_state': initial_state,
            },
        )
        self._workflow_class = workflow_class
        self._workflow = workflow_class()