Git Product home page Git Product logo

Comments (8)

kmmbvnr avatar kmmbvnr commented on May 22, 2024

There is a design problem with django-fsm

It is good to have explicit fields declaration, and support for multiple state fields in the same model. but it makes hard to design how it should looks with inheritance and proxy models.

from django-fsm.

andresdouglas avatar andresdouglas commented on May 22, 2024

I'm hitting this same problem. Is there any way to get rid of those warnings? Are they coming from Django or FSM itself?

from django-fsm.

stevejalim avatar stevejalim commented on May 22, 2024

@andresdouglas The warning comes from django-fsm itself (see https://github.com/kmmbvnr/django-fsm/blob/master/django_fsm/db/fields/fsmfield.py#L117)

from django-fsm.

stevejalim avatar stevejalim commented on May 22, 2024

@kmmbvnr I've been wondering about this and trying a couple of things out, but have had no luck. My first thought was to try to switch the field kwarg to being a string, and then using getattr(self, field) inside inner_transition, but that won't fly because we need to pass field into FSMField() before then (https://github.com/kmmbvnr/django-fsm/blob/master/django_fsm/db/fields/fsmfield.py#L123).

The other thing I might try, in my app, is to monkey-patch the subclass to redeclare the field from the base class, but that may cause Django to cry - and wouldn't be a pretty fix. Will let you know if that at least works - if it does, perhaps making @transition into a triple-nested decorator would work

from django-fsm.

kmmbvnr avatar kmmbvnr commented on May 22, 2024

Yep, think passing a string is a good and django-natural way to work on this issue, But some work on django-fsm internals need to be done. I have time now for doing that

from django-fsm.

stevejalim avatar stevejalim commented on May 22, 2024

Thanks @kmmbvnr, that's great to hear. If I can help, let me know.

from django-fsm.

thomasf avatar thomasf commented on May 22, 2024

I just started to learn generators and such today to try to have -fsm generating diagrams and ..._transitions... functions for proxies and inherited models.. Sadly python is not lisp (lol) and on top of that I have never created any own decorators so I'm on sketchy ground trying to figure things out. I mostly spent time learning about the basic python stuff so any pointers are welcome...

This is at least slightly related to this issue :) (I hope being quite drunk and all)

from django-fsm.

kmmbvnr avatar kmmbvnr commented on May 22, 2024

Inherited models drawing should works in version 2.0

from django-fsm.

Related Issues (20)

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.