fix(users): Use project_id for HybridCloudForeignKey filter#107746
Merged
fix(users): Use project_id for HybridCloudForeignKey filter#107746
Conversation
Found during mypy / django-stubs upgrade in #107710.
2 tasks
Verifies that unset_value correctly deletes user options scoped to a project using the HybridCloudForeignKey project_id field.
armenzg
approved these changes
Feb 6, 2026
| This isn't implemented for user-organization scoped options yet, because it hasn't been needed. | ||
| """ | ||
| self.filter(user=user, project=project, key=key).delete() | ||
| self.filter(user=user, project_id=project.id, key=key).delete() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Found during mypy / django-stubs upgrade in #107710.
Changes
.filter(project=project)to.filter(project_id=project.id)inUserOptionManager.unset_value(). Theprojectfield is aHybridCloudForeignKey, which doesn't support passing a model instance directly — use the_idsuffix instead.'I believe that this code never ran in prod? As the test written breaks with code in master, passes on this branch.