12058 add clone to config context

This commit is contained in:
Arthur 2023-03-27 09:13:05 -07:00 committed by Jeremy Stretch
parent 654e32cbbe
commit a2c7452f90

View File

@ -5,7 +5,7 @@ from django.urls import reverse
from extras.querysets import ConfigContextQuerySet from extras.querysets import ConfigContextQuerySet
from netbox.models import ChangeLoggedModel from netbox.models import ChangeLoggedModel
from netbox.models.features import WebhooksMixin from netbox.models.features import CloningMixin, WebhooksMixin
from utilities.utils import deepmerge from utilities.utils import deepmerge
@ -19,7 +19,7 @@ __all__ = (
# Config contexts # 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 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 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() 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: class Meta:
ordering = ['weight', 'name'] ordering = ['weight', 'name']