Fix: Error when setting table name with inherit #1196
Merged
+25
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Error was thrown when
table_name
is set with inherit=True in base model.inherited check added in the condition where
table_name
is checked for updating db table name.Description
inherited flag argument in
create_history_model
method is used in the condition wheretable_name
is checked. Condition at line 301 ofsimple_history.models
now look like this:if not inherited and self.table_name is not None:
Related Issue
Closes #1195.
Motivation and Context
I found this issue while looking for the solution of #1174.
In documentation it is not mentioned that table_name can't be used with inherit. It is implied that this should work, this inconsistency was the motivation.
How Has This Been Tested?
Ran tests locally using
runtests.py
with python (3.8,3.11) and django 4.1Types of changes
Checklist:
pre-commit run
command to format and lint.AUTHORS.rst
CHANGES.rst