-
Notifications
You must be signed in to change notification settings - Fork 2.7k
17170 Add ability to add contacts to multiple contact groups #18885
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
Merged
Conversation
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
jeremystretch
requested changes
Mar 14, 2025
jeremystretch
requested changes
Mar 18, 2025
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.
Found a few minor cleanup items, but other than those this looks good to go!
jeremystretch
approved these changes
Mar 18, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes: #17170
Changed Contacts Group field to be M2M field so a contact can belong to multiple contact groups. There were some issues as ContactGroup is a nested model (so using TreeNode) which I don't think we have done before (allowing multiple assignments of a TreeNode field).
This caused an issue in utilities.testing.fitersets.py as it was expecting ModelMultipleChoiceField instead of TreeNodeModelMultipleChoiceField (which is derived from ModelMultipleChoiceField) so changed the assert to assertIsInstance: https://github.com/netbox-community/netbox/pull/18885/files#diff-27b47272104ca5b929872465d014bb392aacf97b3fc957695d85ebaa82171e40
Changed group references to groups as it is plural now.
ContactFilterSet was throwing a missing filter error when using group_id, group, needed to change it to contact_group_id, contact_group. Not completely sure why that was complaining with the change.