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

_is_saved fails when pk is 0. #704

Closed
Balthasar-eu opened this issue Jul 2, 2019 · 0 comments
Closed

_is_saved fails when pk is 0. #704

Balthasar-eu opened this issue Jul 2, 2019 · 0 comments

Comments

@Balthasar-eu
Copy link

Balthasar-eu commented Jul 2, 2019

When the primary key is 0 the _is_saved method will always return false, even though 0 is a valid value for a primary key field.
I would recommend changing this line:

if not self.pk or self._mpttfield('tree_id') is None:
from if not self.pk or self._mpttfield('tree_id') is None: to if self.pk not None or self._mpttfield('tree_id') is None: or if (not self.pk and self.pk not 0) or self._mpttfield('tree_id') is None:

@craigds craigds closed this as completed in fd76a81 Jul 2, 2019
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

No branches or pull requests

1 participant