Skip to content

Commit

Permalink
fix(simple_histor.models): Custom history table name
Browse files Browse the repository at this point in the history
Error was thrown when table_name is set with inherit=True in base model.

- add not inherited check

jazzband#1195
  • Loading branch information
muneeb706 committed Jun 24, 2023
1 parent 705a2e1 commit e1e000e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion simple_history/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def create_history_model(self, model, inherited):
attrs.update(self.get_extra_fields(model, fields))
# type in python2 wants str as a first argument
attrs.update(Meta=type("Meta", (), self.get_meta_options(model)))
if self.table_name is not None:
if not inherited and self.table_name is not None:
attrs["Meta"].db_table = self.table_name

# Set as the default then check for overrides
Expand Down

0 comments on commit e1e000e

Please sign in to comment.