Re-add save parameter to @transition decorator as a feature #79
Comments
There are no advantages of having that inside transition decorator. Just call .save() explicitly. |
The advantage is more concise code:
Instead of:
Am I missing something? |
Concise is not an advantage. Without explicit save you have no information is model saved or not, till take a look to models.py file. |
I found it pretty useful though because sometimes I am in the shell and need to transition an element. Also I sometimes forget to save but I know I really want to transition a model. |
if we have the save param, I can simply do
|
If I'll have a time to few more BSD licensed code, the next version of django-fsm would set state before function entry, like I did in the viewflow - https://github.com/viewflow/viewflow/blob/master/viewflow/fsm.py#L165 That would allow writing just @transition(field=state, source=STATE.NEW, target=STATE.LOCKED)
def lock(self):
this.save() |
@kmmbvnr Thank you for everything, but was this implemented? Can we use |
@oxalorg i'm working on new version of viewflow that would contain new version of state management. The main difference that fsm became decoupled from django models and composition used to make it plays together no ETA on release though ( |
I looked through the history and it looks like this used to be a feature. Why was it removed? I would like to use something like this for my own project.
@transition(... save=True)
Thanks for providing a nice library for me to use! :)
The text was updated successfully, but these errors were encountered: