from django.db import models as djmodels

import xworkflows
from django_xworkflows import models

class MyWorkflow(xworkflows.Workflow):
    states = ('foo', 'bar', 'baz')
    transitions = (
        ('foobar', 'foo', 'bar'),
        ('gobaz', ('foo', 'bar'), 'baz'),
        ('bazbar', 'baz', 'bar'),
    )
    initial_state = 'foo'


class MyAltWorkflow(xworkflows.Workflow):
    states = (
        ('a', 'StateA'),
        ('b', 'StateB'),
        ('c', 'StateC'),
    )
    transitions = (
        ('tob', ('a', 'c'), 'b'),
        ('toa', ('b', 'c'), 'a'),
        ('toc', ('a', 'b'), 'c'),
    )
    initial_state = 'a'


class MyWorkflowEnabled(models.WorkflowEnabled, djmodels.Model):
    state = MyWorkflow

    def gobaz(self, foo):
        return foo * 2


class WithTwoWorkflows(models.WorkflowEnabled, djmodels.Model):
    state1 = MyWorkflow
    state2 = MyAltWorkflow

from django.db import models as djmodels

from django_xworkflows import models

class MyWorkflow(models.Workflow):
    states = ('foo', 'bar', 'baz')
    transitions = (
        ('foobar', 'foo', 'bar'),
        ('gobaz', ('foo', 'bar'), 'baz'),
        ('bazbar', 'baz', 'bar'),
    )
    initial_state = 'foo'


class MyAltWorkflow(models.Workflow):
    states = (
        ('a', 'StateA'),
        ('b', 'StateB'),
        ('c', 'StateC'),
    )
    transitions = (
        ('tob', ('a', 'c'), 'b'),
        ('toa', ('b', 'c'), 'a'),
        ('toc', ('a', 'b'), 'c'),
    )
    initial_state = 'a'


class MyWorkflowEnabled(models.WorkflowEnabled, djmodels.Model):
    state = MyWorkflow

    def gobaz(self, foo):
        return foo * 2


class WithTwoWorkflows(models.WorkflowEnabled, djmodels.Model):
    state1 = MyWorkflow()
    state2 = MyAltWorkflow()

Use imports from django_xworkflows instead of imports from xworkflows in tests
Use imports from django_xworkflows instead of imports from xworkflows in tests

Signed-off-by: Raphaël Barrois <8eb3b37a023209373fcd61a2fdc08256a14fb19c@polyconseil.fr>

  from django.db import models as djmodels
  
- import xworkflows
  from django_xworkflows import models
  
- class MyWorkflow(xworkflows.Workflow):
+ class MyWorkflow(models.Workflow):
      states = ('foo', 'bar', 'baz')
      transitions = (
          ('foobar', 'foo', 'bar'),
          ('gobaz', ('foo', 'bar'), 'baz'),
          ('bazbar', 'baz', 'bar'),
      )
      initial_state = 'foo'
  
  
- class MyAltWorkflow(xworkflows.Workflow):
+ class MyAltWorkflow(models.Workflow):
      states = (
          ('a', 'StateA'),
          ('b', 'StateB'),
          ('c', 'StateC'),
      )
      transitions = (
          ('tob', ('a', 'c'), 'b'),
          ('toa', ('b', 'c'), 'a'),
          ('toc', ('a', 'b'), 'c'),
      )
      initial_state = 'a'
  
  
  class MyWorkflowEnabled(models.WorkflowEnabled, djmodels.Model):
      state = MyWorkflow
  
      def gobaz(self, foo):
          return foo * 2
  
  
  class WithTwoWorkflows(models.WorkflowEnabled, djmodels.Model):
-     state1 = MyWorkflow
+     state1 = MyWorkflow()
-     state2 = MyAltWorkflow
+     state2 = MyAltWorkflow()
  
Use imports from django_xworkflows instead of imports from xworkflows in tests
## Code Before:
from django.db import models as djmodels

import xworkflows
from django_xworkflows import models

class MyWorkflow(xworkflows.Workflow):
    states = ('foo', 'bar', 'baz')
    transitions = (
        ('foobar', 'foo', 'bar'),
        ('gobaz', ('foo', 'bar'), 'baz'),
        ('bazbar', 'baz', 'bar'),
    )
    initial_state = 'foo'


class MyAltWorkflow(xworkflows.Workflow):
    states = (
        ('a', 'StateA'),
        ('b', 'StateB'),
        ('c', 'StateC'),
    )
    transitions = (
        ('tob', ('a', 'c'), 'b'),
        ('toa', ('b', 'c'), 'a'),
        ('toc', ('a', 'b'), 'c'),
    )
    initial_state = 'a'


class MyWorkflowEnabled(models.WorkflowEnabled, djmodels.Model):
    state = MyWorkflow

    def gobaz(self, foo):
        return foo * 2


class WithTwoWorkflows(models.WorkflowEnabled, djmodels.Model):
    state1 = MyWorkflow
    state2 = MyAltWorkflow

## Instruction:
Use imports from django_xworkflows instead of imports from xworkflows in tests
## Code After:
from django.db import models as djmodels

from django_xworkflows import models

class MyWorkflow(models.Workflow):
    states = ('foo', 'bar', 'baz')
    transitions = (
        ('foobar', 'foo', 'bar'),
        ('gobaz', ('foo', 'bar'), 'baz'),
        ('bazbar', 'baz', 'bar'),
    )
    initial_state = 'foo'


class MyAltWorkflow(models.Workflow):
    states = (
        ('a', 'StateA'),
        ('b', 'StateB'),
        ('c', 'StateC'),
    )
    transitions = (
        ('tob', ('a', 'c'), 'b'),
        ('toa', ('b', 'c'), 'a'),
        ('toc', ('a', 'b'), 'c'),
    )
    initial_state = 'a'


class MyWorkflowEnabled(models.WorkflowEnabled, djmodels.Model):
    state = MyWorkflow

    def gobaz(self, foo):
        return foo * 2


class WithTwoWorkflows(models.WorkflowEnabled, djmodels.Model):
    state1 = MyWorkflow()
    state2 = MyAltWorkflow()
