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

Handle zero as valid pk/id in get_resource_id util method #1245

Merged

Conversation

humayunah
Copy link
Contributor

@humayunah humayunah commented Jul 22, 2024

Fixes #1244

Description of the Change

  • handle zero as valid pk/id in get_resource_id util method
  • update tests to include cases where ID is zero

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

- update tests to include cases where ID is zero
@humayunah
Copy link
Contributor Author

@sliverc please review this and let me know if anything needs to be changed/added.

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job. Thanks for your work. I have only updated it slightly to avoid double lookup (hasattr) for performance reasons. Ready for merging.

@sliverc sliverc merged commit 75a5424 into django-json-api:main Jul 23, 2024
11 checks passed
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 this pull request may close these issues.

id column integer primary key of 0 gets returned as null
2 participants