#435 Fix instance creation state check#436
#435 Fix instance creation state check#436MaximZemskov wants to merge 6 commits intojazzband:masterfrom
Conversation
auvipy
left a comment
There was a problem hiding this comment.
can you update the tests t verify this change won't regress?
auvipy
left a comment
There was a problem hiding this comment.
can you make the failing tests pass?
|
@auvipy I fixed one of two failed tests. Trying to fix last test but can't figure out what is the problem. Stucked with fixing this test https://github.com/jazzband/django-model-utils/blob/master/tests/test_fields/test_field_tracker.py#L590. Can't understand why there is Will be glad if you can help me. |
|
@auvipy I'm not sure why a review by me was requested. Was this an error, or do you want me to help with something? |
|
GitHub shows you recently modified the files that's why I requested a review |
|
Looking at my previous contributions to this project, the only file I have edited that is in this pull request is |
|
Looks like at the moment of execution |
|
Found the problem.
|
Problem
FieldTracker has incorrect behaviour if PK field isn't a
AutoFIeld. Link to issue #435.Solution
Django has a
ModelStateobject to determine if objects is in creation state or already exists in db. Replacingif not self.instance.pk is Nonewithif self.instance._state.addingsolve the problem.Commandments
CHANGES.rstfile to describe the changes, and quote according issue withGH-<issue_number>.