diff --git a/netbox_branching/__init__.py b/netbox_branching/__init__.py index 4aeb70c..7190892 100644 --- a/netbox_branching/__init__.py +++ b/netbox_branching/__init__.py @@ -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 diff --git a/netbox_branching/constants.py b/netbox_branching/constants.py index d641b63..ea9e7fa 100644 --- a/netbox_branching/constants.py +++ b/netbox_branching/constants.py @@ -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.*', )