mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduce ContactsMixin
This commit is contained in:
@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from dcim.models import Device
|
||||
from netbox.models import OrganizationalModel, PrimaryModel
|
||||
from netbox.models.features import ContactsMixin
|
||||
from virtualization.choices import *
|
||||
|
||||
__all__ = (
|
||||
@ -28,20 +29,16 @@ class ClusterType(OrganizationalModel):
|
||||
return reverse('virtualization:clustertype', args=[self.pk])
|
||||
|
||||
|
||||
class ClusterGroup(OrganizationalModel):
|
||||
class ClusterGroup(ContactsMixin, OrganizationalModel):
|
||||
"""
|
||||
An organizational group of Clusters.
|
||||
"""
|
||||
# Generic relations
|
||||
vlan_groups = GenericRelation(
|
||||
to='ipam.VLANGroup',
|
||||
content_type_field='scope_type',
|
||||
object_id_field='scope_id',
|
||||
related_query_name='cluster_group'
|
||||
)
|
||||
contacts = GenericRelation(
|
||||
to='tenancy.ContactAssignment'
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ('name',)
|
||||
@ -52,7 +49,7 @@ class ClusterGroup(OrganizationalModel):
|
||||
return reverse('virtualization:clustergroup', args=[self.pk])
|
||||
|
||||
|
||||
class Cluster(PrimaryModel):
|
||||
class Cluster(ContactsMixin, PrimaryModel):
|
||||
"""
|
||||
A cluster of VirtualMachines. Each Cluster may optionally be associated with one or more Devices.
|
||||
"""
|
||||
@ -101,9 +98,6 @@ class Cluster(PrimaryModel):
|
||||
object_id_field='scope_id',
|
||||
related_query_name='cluster'
|
||||
)
|
||||
contacts = GenericRelation(
|
||||
to='tenancy.ContactAssignment'
|
||||
)
|
||||
|
||||
clone_fields = (
|
||||
'type', 'group', 'status', 'tenant', 'site',
|
||||
|
Reference in New Issue
Block a user