-
Notifications
You must be signed in to change notification settings - Fork 0
NPL-374 Add Mixin Support and make CustomObject class ABC #110
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
bctiemann
approved these changes
Jul 22, 2025
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.
Fixes: #374
This issue is for bookmark support as all the mixins are broken up into separate issues, however the root cause of most of these are the same and the fix needs to work in all cases so this PR addresses multiple mixins.
There was also a root issue where CustomObject class was not abstract so the CustomObjects were using multi-table inheritance. This PR makes it an ABC and fixes the view querysets as they can't directly reference this model anymore. Unfortunately this makes any previously created CO not migratable anymore so any database needs to be re-created.
TaggingMixin is special case as it has a custom through model which will cause naming collisions for TaggableManager - "ValueError: You can't have two TaggableManagers with the same through model.", so the mixin can't be on the ABC, but instead is dynamically added to the CO in get_model creating the through model with a unique name.
Note: For most of these to work it needs changes in NetBox in how ObjectTypeManager and ObjectChangeQuerySet works. For temporary testing can modify ObjectTypeManager to return all objects:
return self.get_queryset()
Should also fix multi-object field deletion.
The following mixins should be addressed in this PR