Skip to content

Commit

Permalink
Closes #116: Disable branching support for applicable core models
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Sep 12, 2024
1 parent 9c40af6 commit 03c8731
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
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.*',
)

0 comments on commit 03c8731

Please sign in to comment.