Skip to content

Commit f7c1c66

Browse files
committed
Handle non-abstract inheritance
1 parent 7b12aef commit f7c1c66

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

simple_history/models.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ def save_without_historical_record(self, *args, **kwargs):
7171

7272
def finalize(self, sender, **kwargs):
7373
try:
74-
if not issubclass(sender, self.cls):
75-
return
74+
hint_class = self.cls
7675
except AttributeError: # called via `register`
7776
pass
77+
else:
78+
if not hint_class is sender: # set in concrete
79+
if not (hint_class._meta.abstract
80+
and issubclass(sender, hint_class)): # set in abstract
81+
return
7882
history_model = self.create_history_model(sender)
7983
module = importlib.import_module(self.module)
8084
setattr(module, history_model.__name__, history_model)

0 commit comments

Comments
 (0)