Skip to content

Commit 03c8731

Browse files
committed
Closes #116: Disable branching support for applicable core models
1 parent 9c40af6 commit 03c8731

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

netbox_branching/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ def ready(self):
5454
# Wildcard exclusion for all models in this app
5555
if f'{app_label}.*' in exempt_models:
5656
continue
57-
branching_models[app_label] = [
57+
models = [
5858
model for model in models
5959
if f'{app_label}.{model}' not in exempt_models
6060
]
61+
if models:
62+
branching_models[app_label] = models
6163
registry['model_features']['branching'] = branching_models
6264

6365

netbox_branching/constants.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@
1212

1313
# Models for which branching support is explicitly disabled
1414
EXEMPT_MODELS = (
15+
# Exempt applicable core NetBox models
16+
'core.*',
17+
'extras.branch',
18+
'extras.customfield',
19+
'extras.customfieldchoiceset',
20+
'extras.customlink',
21+
'extras.eventrule',
22+
'extras.exporttemplate',
23+
'extras.notificationgroup',
24+
'extras.savedfilter',
25+
'extras.webhook',
26+
27+
# Exempt all models from this plugin and from netbox-changes
1528
'netbox_branching.*',
1629
'netbox_changes.*',
1730
)

0 commit comments

Comments
 (0)