Skip to content

Commit

Permalink
Handle non-abstract inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
macro1 committed Dec 22, 2015
1 parent 7b12aef commit f7c1c66
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions simple_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,14 @@ def save_without_historical_record(self, *args, **kwargs):

def finalize(self, sender, **kwargs):
try:
if not issubclass(sender, self.cls):
return
hint_class = self.cls
except AttributeError: # called via `register`
pass
else:
if not hint_class is sender: # set in concrete
if not (hint_class._meta.abstract
and issubclass(sender, hint_class)): # set in abstract
return
history_model = self.create_history_model(sender)
module = importlib.import_module(self.module)
setattr(module, history_model.__name__, history_model)
Expand Down

0 comments on commit f7c1c66

Please sign in to comment.