-
-
Notifications
You must be signed in to change notification settings - Fork 250
[Fix] Resolve 500 FieldError in DeviceLocationView #1110 #1153
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] Resolve 500 FieldError in DeviceLocationView #1110 #1153
Conversation
Adding organization_lookup = 'organization__in' to the view forces it to use the correct organization field and prevents the crash. Fixes #1110
nemesifier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a test which replicates the bug and fails without the patch, otherwise another contributor may inadvertently break this again in the future.
This test confirms the API correctly returns a 404 Not Found instead of crashing with a 500 FieldError. Fixes #1110
📝 WalkthroughWalkthroughThis pull request addresses a crash occurring when non-superuser accounts access the device location API endpoint. The fix adds an Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nemesifier
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @stktyagi 👍
Adding organization_lookup = 'organization__in' to the view forces it to use the correct organization field and prevents the crash.
Fixes #1110
Checklist
Reference to Existing Issue
Closes #1110
Description of Changes
The permission mixin was incorrectly using the child's organization path (content_object__organization) to filter the parent Device including organization_lookup = 'organization__in' to the view fixes it.