Skip to content

Commit

Permalink
instance.state should return a StateWrapper object
Browse files Browse the repository at this point in the history
The type of the returned value when the state was not yet set was
inconsistent: State instead of StateWrapper
  • Loading branch information
Sébastien Diemer authored and rbarrois committed Feb 5, 2018
1 parent 1307bf3 commit 97bb5db
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion django_xworkflows/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def __get__(self, instance, owner):
if self.parent_property and hasattr(self.parent_property, '__get__'):
# We override a property.
return self.parent_property.__get__(instance, owner)
return instance.__dict__.get(self.field.name, self.field.workflow.initial_state)
default = self.field.to_python(self.field.workflow.initial_state)
return instance.__dict__.get(self.field.name, default)
else:
return self.field.workflow

Expand Down

0 comments on commit 97bb5db

Please sign in to comment.