Skip to content

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
merged 28 commits into from
Jul 22, 2025

Conversation

arthanson
Copy link
Contributor

@arthanson arthanson commented Jul 21, 2025

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

  • BookmarksMixin
  • ChangeLoggingMixin - change logs will appear / work if modify ObjectChangeQuerySet in NetBox, however branching support isn't implemented (separate PR)
  • CloningMixin
  • CustomLinksMixin - needs header formatting (separate ticket)
  • CustomValidationMixin
  • ExportTemplatesMixin
  • JournalingMixin
  • NotificationsMixin - needs further tests
  • EventRulesMixin
  • TaggingMixin

@arthanson arthanson changed the base branch from main to feature July 22, 2025 18:11
@arthanson arthanson changed the title DRAFT: NPL-374 bookmark 3 NPL-374 Add Mixin Support and make CustomObject class ABC Jul 22, 2025
@arthanson arthanson requested a review from bctiemann July 22, 2025 18:12
@arthanson arthanson marked this pull request as ready for review July 22, 2025 18:49
@arthanson arthanson merged commit 78994a6 into feature Jul 22, 2025
3 checks passed
@bctiemann bctiemann deleted the NPL-374-bookmark-3 branch August 6, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants