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

Fix pk error #806

Merged
merged 4 commits into from
Sep 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Authors
- `Alex Todorov <https://github.com/atodorov>`_
- David Smith (`smithdc1 <https://github.com/smithdc1>`_)
- Shi Han Ng (`shihanng <https://github.com/shihanng>`_)
- `ddusi <https://github.com/ddusi>`_

Background
==========
Expand Down
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changes
Unreleased
----------

- Fixed `update_change_reason` in pk (gh-806)
- Fixed bug where serializer of djangorestframework crashed if used with ``OrderingFilter`` (gh-821)
- Fixed `make format` so it works by using tox (gh-859)
- Fixed bug where latest() is not idempotent for identical ``history_date`` records (gh-861)
Expand Down
2 changes: 1 addition & 1 deletion simple_history/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def update_change_reason(instance, reason):
attrs = {}
model = type(instance)
manager = instance if instance.id is not None else model
manager = instance if instance.pk is not None else model
history = get_history_manager_for_model(manager)
history_fields = [field.attname for field in history.model._meta.fields]
for field in instance._meta.fields:
Expand Down