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

Fix KeyError in nested serialization of ConfigContext, and add ObjectChange API test, add ObjectChange unique_together #3896

Merged
merged 4 commits into from
Jun 12, 2023

Conversation

glennmatthews
Copy link
Contributor

@glennmatthews glennmatthews commented Jun 9, 2023

Closes: #3885

See also #3872 (comment)

What's Changed

Change self.fields.pop("dynamic_groups") to self.fields.pop("dynamic_groups", None) as in the case of nested serialization of a ConfigContext (such as within an ObjectChange), M2M fields such as dynamic_groups are already automatically excluded from the serializer.

Add missing API test cases for the ObjectChange REST API read-only endpoint and confirm that they catch this specific error.

Add a unique_together on ObjectChange model of (time, request_id, changed_object_type, changed_object_id) both for general purpose data correctness but also to provide an appropriate natural_key for this model (fixes #3885).

note: [request_id, changed_object_type, changed_object_id] alone is not a sufficiently broad unique_together as a single bulk-action request may result in changing the same object multiple times. Thank you unit tests!

Add basic model test case for ObjectChange to exercise its natural-key and composite-key construction.

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • n/a Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • n/a Documentation Updates (when adding/changing features)
  • n/a Example Plugin Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

@glennmatthews glennmatthews self-assigned this Jun 9, 2023
@glennmatthews glennmatthews added this to the v2.0.0 milestone Jun 9, 2023
@glennmatthews glennmatthews changed the title Fix KeyError in nested serialization of ConfigContext, and add ObjectChange API test Fix KeyError in nested serialization of ConfigContext, and add ObjectChange API test, add ObjectChange unique_together Jun 12, 2023
@bryanculver bryanculver added the type: bug Something isn't working as expected label Jun 12, 2023
Copy link
Contributor

@jathanism jathanism left a comment

Choose a reason for hiding this comment

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

:shipit:

@glennmatthews glennmatthews merged commit 7722307 into next Jun 12, 2023
19 checks passed
@glennmatthews glennmatthews deleted the u/glennmatthews-dynamic-groups-keyerror-fix branch June 12, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants