-
-
Notifications
You must be signed in to change notification settings - Fork 24
Ensure dirty-bit is updated when calling save on a syncable model with update_fields
#326
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
base: release-v0.8.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.8.11" | ||
| __version__ = "0.8.12" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,6 +67,15 @@ def test_syncable_save(self): | |
| user.save(update_dirty_bit_to=None) | ||
| self.assertTrue(MyUser.objects.first()._morango_dirty_bit) | ||
|
|
||
| def test_syncable_save_with_update_fields_persists_dirty_bit(self): | ||
| user = MyUser.objects.first() | ||
| user.save(update_dirty_bit_to=False) | ||
| self.assertFalse(MyUser.objects.first()._morango_dirty_bit) | ||
|
|
||
| user.username = "updated-name" | ||
| user.save(update_fields=["username"]) | ||
| self.assertTrue(MyUser.objects.first()._morango_dirty_bit) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion: This test covers the common case well. Consider adding a second assertion for |
||
|
|
||
| def test_syncing_objects_manager_with_custom_default_manager(self): | ||
| """Test that syncing_objects manager includes all objects even when default manager filters them out""" | ||
| # Create some test objects | ||
|
|
||
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.
praise: The
update_dirty_bit_to is not Noneguard correctly handles the opt-out case — callers who passNoneto suppress all dirty-bit handling also suppress theupdate_fieldsinjection, which is exactly right.