Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple state fields #74

Open
blueyed opened this issue Jun 15, 2018 · 1 comment
Open

Handle multiple state fields #74

blueyed opened this issue Jun 15, 2018 · 1 comment

Comments

@blueyed
Copy link
Contributor

blueyed commented Jun 15, 2018

Currently the field keyword argument in the signal handler is not being handled.

Therefore, if multiple state fields (e.g. "state" and "second_state") are being used those cannot be easily distinguished in the logs.

Do you think it makes sense to add "field_name" to StateLog, where kwargs['field'].name would be stored into?

This could also be used in __str__ then, but is typically redundant then (since often only a single state field is used probably).

@jonasvp
Copy link
Contributor

jonasvp commented Jun 19, 2018

This wouldn't be hard but does django-fsm actually send a field kwarg? It's not documented here: https://github.com/kmmbvnr/django-fsm#signals

Also, since transitions always refer to a specific field, you can just do getattr(Model, transition)._django_fsm.field to get to it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants