Skip to content

Commit 7fe4e51

Browse files
ticosaxkmmbvnr
authored andcommitted
When multiple classes inherit from an abstract class
only the first class get a chance to work fixes #256
1 parent 9f13951 commit 7fe4e51

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

django_fsm/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ def is_field_transition_method(attr):
426426
attr._django_fsm.field in [self, self.name]
427427
or (
428428
isinstance(attr._django_fsm.field, Field)
429-
and issubclass(self.model, attr._django_fsm.field.model)
430429
and attr._django_fsm.field.name == self.name
431430
and attr._django_fsm.field.creation_counter == self.creation_counter
432431
)

django_fsm/tests/test_abstract_inheritance.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ def publish(self):
1515
pass
1616

1717

18+
class AnotherFromAbstractModel(BaseAbstractModel):
19+
"""
20+
This class exists to trigger a regression when multiple concrete classes
21+
inherit from a shared abstract class (example: BaseAbstractModel).
22+
Don't try to remove it.
23+
"""
24+
@transition(field="state", source="published", target="sticked")
25+
def stick(self):
26+
pass
27+
28+
1829
class InheritedFromAbstractModel(BaseAbstractModel):
1930
@transition(field="state", source="published", target="sticked")
2031
def stick(self):

0 commit comments

Comments
 (0)