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 Aug 22, 2014
1 parent 40b48ed commit dd37d55
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 @@ -91,10 +91,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 dd37d55

Please sign in to comment.