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

make_transition on unsaved fails #23

Open
ramn opened this issue Apr 3, 2012 · 1 comment
Open

make_transition on unsaved fails #23

ramn opened this issue Apr 3, 2012 · 1 comment

Comments

@ramn
Copy link
Contributor

ramn commented Apr 3, 2012

Problem:

If I have log_transitions = True in my state machine, and then make_transition on an unsaved model object, we crash since 'self' (model object) doesn't have an id but an id is assumed here:
model_methods.py, method make_transition, line 151:
_state_log_model.objects.create(
on=self,

Discussion:
Perhaps we could have an explicit exception for this case, stating that the object needs an id/to be saved beforehand.

@jonathanslenders
Copy link
Contributor

Thanks for the bug report! Indeed, we assumed that an object needs to be saved before running any state transitions on it. I will throw an exception instead.

gvangool added a commit to gvangool/django-states2 that referenced this issue Oct 6, 2015
gvangool added a commit to gvangool/django-states2 that referenced this issue Oct 6, 2015
gvangool added a commit to gvangool/django-states2 that referenced this issue Oct 6, 2015
gvangool added a commit to gvangool/django-states2 that referenced this issue May 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants