Skip to content

Closes #116: Disable branching support for applicable core models #117

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 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion netbox_branching/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ def ready(self):
# Wildcard exclusion for all models in this app
if f'{app_label}.*' in exempt_models:
continue
branching_models[app_label] = [
models = [
model for model in models
if f'{app_label}.{model}' not in exempt_models
]
if models:
branching_models[app_label] = models
registry['model_features']['branching'] = branching_models


Expand Down
13 changes: 13 additions & 0 deletions netbox_branching/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@

# Models for which branching support is explicitly disabled
EXEMPT_MODELS = (
# Exempt applicable core NetBox models
'core.*',
'extras.branch',
'extras.customfield',
'extras.customfieldchoiceset',
'extras.customlink',
'extras.eventrule',
'extras.exporttemplate',
'extras.notificationgroup',
'extras.savedfilter',
'extras.webhook',

# Exempt all models from this plugin and from netbox-changes
'netbox_branching.*',
'netbox_changes.*',
)