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

Lookups fail for autofield when the base id is zero #29

Closed
lee-hodg opened this issue Oct 29, 2018 · 1 comment
Closed

Lookups fail for autofield when the base id is zero #29

lee-hodg opened this issue Oct 29, 2018 · 1 comment

Comments

@lee-hodg
Copy link

In hashid_field/hashid.py I think it should read like:

        value = self.decode(id)
        # NB value could be zero
        if value is not None:
            self._id = value
            self._hashid = id

else if value=0 like it would be for an AutoField starting from zero, then decode appears to fail and it leads to valueerror even though the decode actually returned a non-null value

@nshafer
Copy link
Owner

nshafer commented Oct 31, 2018

Thanks! I added a test and merged your PR. Fixed in version 2.1.5.

@nshafer nshafer closed this as completed Oct 31, 2018
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

2 participants