Introduce ImageAttachmentsMixin

This commit is contained in:
Jeremy Stretch
2023-08-04 09:34:15 -04:00
parent 14988fc91c
commit 14e23c3d00
6 changed files with 27 additions and 38 deletions

View File

@@ -15,6 +15,7 @@ from dcim.choices import *
from dcim.constants import *
from dcim.svg import RackElevationSVG
from netbox.models import OrganizationalModel, PrimaryModel
from netbox.models.features import ImageAttachmentsMixin
from utilities.choices import ColorChoices
from utilities.fields import ColorField, NaturalOrderingField
from utilities.utils import array_to_string, drange, to_grams
@@ -52,7 +53,7 @@ class RackRole(OrganizationalModel):
return reverse('dcim:rackrole', args=[self.pk])
class Rack(PrimaryModel, WeightMixin):
class Rack(ImageAttachmentsMixin, PrimaryModel, WeightMixin):
"""
Devices are housed within Racks. Each rack has a defined height measured in rack units, and a front and rear face.
Each Rack is assigned to a Site and (optionally) a Location.
@@ -196,9 +197,6 @@ class Rack(PrimaryModel, WeightMixin):
contacts = GenericRelation(
to='tenancy.ContactAssignment'
)
images = GenericRelation(
to='extras.ImageAttachment'
)
clone_fields = (
'site', 'location', 'tenant', 'status', 'role', 'type', 'width', 'u_height', 'desc_units', 'outer_width',