Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean_duplicate_history ignores excluded_fields in models declaration #1138

Closed
sambot83 opened this issue Mar 8, 2023 · 3 comments · Fixed by #1139
Closed

clean_duplicate_history ignores excluded_fields in models declaration #1138

sambot83 opened this issue Mar 8, 2023 · 3 comments · Fixed by #1139

Comments

@sambot83
Copy link

sambot83 commented Mar 8, 2023

If your model uses:
history = HistoricalRecords(
excluded_fields=["myfield"]
)

calling clean_duplicate_history will ending by an error:
simple_history/models.py", line 890, in diff_against
old_value = old_values[field]
KeyError: 'myfield'

why because in diff_against() :
included_fields = {
f.name for f in old_history.instance_type._meta.fields if f.editable
} ignores excluded_fields in the models declaration.

@ddabble
Copy link
Member

ddabble commented Mar 8, 2023

Thanks for the report! This has already been fixed by #1038, but the changes have not yet been released. I'll try creating a new release 🙂

@ddabble
Copy link
Member

ddabble commented Mar 8, 2023

Release 3.3.0 has now been uploaded to the Jazzband website, and we should only have to wait for one of the project leads or roadies to release it to PyPI 🙂 (see https://jazzband.co/about/releases)

@sambot83
Copy link
Author

sambot83 commented Mar 9, 2023

Great! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants