From 293afab7306544d33babfb3ff6e28f20a0701972 Mon Sep 17 00:00:00 2001 From: Arthur Date: Mon, 27 Mar 2023 09:13:05 -0700 Subject: [PATCH] 12058 add clone to config context --- netbox/extras/models/configcontexts.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/netbox/extras/models/configcontexts.py b/netbox/extras/models/configcontexts.py index d8d3510d7..4a38115dd 100644 --- a/netbox/extras/models/configcontexts.py +++ b/netbox/extras/models/configcontexts.py @@ -5,7 +5,7 @@ from django.urls import reverse from extras.querysets import ConfigContextQuerySet from netbox.models import ChangeLoggedModel -from netbox.models.features import WebhooksMixin +from netbox.models.features import CloningMixin, WebhooksMixin from utilities.utils import deepmerge @@ -19,7 +19,7 @@ __all__ = ( # Config contexts # -class ConfigContext(WebhooksMixin, ChangeLoggedModel): +class ConfigContext(CloningMixin, WebhooksMixin, ChangeLoggedModel): """ A ConfigContext represents a set of arbitrary data available to any Device or VirtualMachine matching its assigned qualifiers (region, site, etc.). For example, the data stored in a ConfigContext assigned to site A and tenant B @@ -108,6 +108,12 @@ class ConfigContext(WebhooksMixin, ChangeLoggedModel): objects = ConfigContextQuerySet.as_manager() + clone_fields = ( + 'weight', 'is_active', 'regions', 'site_groups', 'sites', 'locations', 'device_types', + 'roles', 'platforms', 'cluster_types', 'cluster_groups', 'clusters', 'tenant_groups', + 'tenants', 'tags', 'data', + ) + class Meta: ordering = ['weight', 'name']