Coder Social home page Coder Social logo

django_xworkflows's People

Contributors

btoueg avatar dbaty avatar dzen avatar gagaro avatar kanu avatar rbarrois avatar timgates42 avatar xordoquy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django_xworkflows's Issues

Misleading example Django model in README?

The README defines the following model as an example:

class MyModel(xwf_models.WorkflowEnabled):

    state = xwf_models.StateField(MyWorkflow)

After a small round of debugging and reading the tests, should this in fact be:

class MyModel(xwf_models.WorkflowEnabled, models.Model):

    state = xwf_models.StateField(MyWorkflow)

Add support for UUID pks

Hello @rbarrois ,
this is exactly the support I've always dreamed of for managing workflows in a Django project. Thank you.

I failed to use GenericTransitionLog() as my Models use UUID as pks.

At the moment I solved this at project level by introducing this variant, which seems to work:

class GenericTransitionLogWithUUID(xwf_models.GenericTransitionLog):
    """Abstract model for a minimal database logging setup.

    Specializes GenericTransitionLog to use a GenericForeignKey with UUID as pk.
    """
    content_id = models.UUIDField(_("Content id"), blank=True, null=True, db_index=True)

    class Meta:
        abstract = True

I think UUID should be considered first-citizens in the Django ecosystem sooner or later ... in case, I can add a specific unit test and prepare a PR. Let me know if you're interested; I do not mind a negative answer at all.

I would also add on_delete here and there to the ForeignKeys for better compatibility with recent versions of Django

Compatibility issue with Django 3.0

Django 3.0 was released this month.

When we tried to upload our project to django 3.0, we realized django-xworflows is not compatible.

Here is the problem we met:

python manage.py runserver
…
File "/home/aides/django_xworkflows/django_xworkflows/models.py", line 19, in <module>
    from django.utils.encoding import force_text, python_2_unicode_compatible
ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/aides/.virtualenvs/aides/lib/python3.7/site-packages/django/utils/encoding.py)

The issue is caused by the following removal of aliases from the django codebase.

Add creation to Transitions history

I would like to save a record in the TransitionLog when the instance is initially created; conceptually when initial_state is assigned

I wonder which is the cleanest approach, and most consistent with the current xWorkflows setup.

Any suggestion? Thanks

Migration issue with 0.12.1 and Django 1.11

Hello, very thank you for your provide the django workflow tools, but using a tool when you encounter a problem, please answer. Thanks
The question is:

class OnlinePublishFlow(xwf_models.WorkflowEnabled, models.Model):

    online_state = xwf_models.StateField(OnlinePublishWorkflow)
    publish =  models.OneToOneField(APublish, verbose_name=u'test')

Execute python manage. Py makemigrations errors as follows:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 177, in handle
    migration_name=self.migration_name,
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 47, in changes
    changes = self._detect_changes(convert_apps, graph)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 198, in _detect_changes
    self._optimize_migrations()
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/autodetector.py", line 362, in _optimize_migrations
    migration.operations = MigrationOptimizer().optimize(migration.operations, app_label=app_label)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/optimizer.py", line 38, in optimize
    result = self.optimize_inner(operations, app_label)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/optimizer.py", line 53, in optimize_inner
    result = operation.reduce(other, in_between, app_label)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 229, in reduce
    return super(CreateModel, self).reduce(operation, in_between, app_label=app_label)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 40, in reduce
    not operation.references_model(self.name, app_label)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 123, in references_model
    model_app_label, model_name = self.model_to_key(model)
  File "/root/workspaces/reapal-cmdb/lib/python2.7/site-packages/django/db/migrations/operations/models.py", line 137, in model_to_key
    return model._meta.app_label, model._meta.object_name
AttributeError: type object 'WorkflowEnabled' has no attribute '_meta'

Looking forward to your answer thank you

Django 4.x support

Hello! 😄 first of all thanks for the library, it's so useful for my team!
I'd like to ask if there's any plan to support Django 4.x in a new release.

Thanks so much in advance!

python manage.py makemigrations fails

I have copied the exaple in the readme in my existing project . then i did python manage.py makemigration and it fails

this is the error am getting

File "/home/mwas/PycharmProject/restframework_tutorial/example/models.py", line 81, in
class MyModel(xworkflows.WorkflowEnabled, models.Model):
File "/home/mwas/PycharmProject/restframework_tutorial/.venv/local/lib/python2.7/site-packages/xworkflows/base.py", line 1049, in new
cls = super(WorkflowEnabledMeta, mcs).new(mcs, name, bases, attrs)
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

am using django 1.7.1

0.9.4 release

Hello,

Is the release of the 0.9.4 planned ?

Thanks

Multiple xwf_models.Workflow

Hello,

Great app ... thanks !

I'm looking for a way to have workflow "instance based". I have multiple instance of my model, say InstA and InstB, and I would like to assign them different workflows, based on, for example instance attribute (for instance the foo boolean field in my example below).
I tried this, but it doesn't work :

class MyModel(xwf_models.WorkflowEnabled, models.Model):

    def __init__(self, *args, **kwargs):
        # try to dynamically set the workflow based on a field for example
        super(MyModel, self).__init__(*args, **kwargs)
        if self.foo is True:  # example of a thing I would like to achieve, to have custom workflow based on instance attribute
            field = xwf_models.StateField(BaseWorkflow2)
            field.contribute_to_class(CustomFormInstance, "state")

    state = xwf_models.StateField(BaseWorkflow)
    foo = models.BooleanField()

Is my problem clear, and do you thing django_xworkflows could face this use case ?

Regards,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.