Просмотр исходного кода

Closes #21228: Add image attachments support to RackType model (#21276)

Aditya Sharma 2 недель назад
Родитель
Сommit
245495b2fe
4 измененных файлов с 4 добавлено и 3 удалено
  1. 1 1
      netbox/dcim/graphql/filters.py
  2. 1 1
      netbox/dcim/graphql/types.py
  3. 1 1
      netbox/dcim/models/racks.py
  4. 1 0
      netbox/dcim/views.py

+ 1 - 1
netbox/dcim/graphql/filters.py

@@ -893,7 +893,7 @@ class PowerPortTemplateFilter(ModularComponentTemplateFilterMixin, ChangeLoggedM
 
 
 
 
 @strawberry_django.filter_type(models.RackType, lookups=True)
 @strawberry_django.filter_type(models.RackType, lookups=True)
-class RackTypeFilter(RackFilterMixin, WeightFilterMixin, PrimaryModelFilter):
+class RackTypeFilter(ImageAttachmentFilterMixin, RackFilterMixin, WeightFilterMixin, PrimaryModelFilter):
     form_factor: BaseFilterLookup[Annotated['RackFormFactorEnum', strawberry.lazy('dcim.graphql.enums')]] | None = (
     form_factor: BaseFilterLookup[Annotated['RackFormFactorEnum', strawberry.lazy('dcim.graphql.enums')]] | None = (
         strawberry_django.filter_field()
         strawberry_django.filter_field()
     )
     )

+ 1 - 1
netbox/dcim/graphql/types.py

@@ -734,7 +734,7 @@ class PowerPortTemplateType(ModularComponentTemplateType):
     filters=RackTypeFilter,
     filters=RackTypeFilter,
     pagination=True
     pagination=True
 )
 )
-class RackTypeType(PrimaryObjectType):
+class RackTypeType(ImageAttachmentsMixin, PrimaryObjectType):
     rack_count: BigInt
     rack_count: BigInt
     manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
     manufacturer: Annotated["ManufacturerType", strawberry.lazy('dcim.graphql.types')]
 
 

+ 1 - 1
netbox/dcim/models/racks.py

@@ -122,7 +122,7 @@ class RackBase(WeightMixin, PrimaryModel):
         abstract = True
         abstract = True
 
 
 
 
-class RackType(RackBase):
+class RackType(ImageAttachmentsMixin, RackBase):
     """
     """
     Devices are housed within Racks. Each rack has a defined height measured in rack units, and a front and rear face.
     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.
     Each Rack is assigned to a Site and (optionally) a Location.

+ 1 - 0
netbox/dcim/views.py

@@ -880,6 +880,7 @@ class RackTypeView(GetRelatedModelsMixin, generic.ObjectView):
             panels.RackWeightPanel(title=_('Weight'), exclude=['total_weight']),
             panels.RackWeightPanel(title=_('Weight'), exclude=['total_weight']),
             CustomFieldsPanel(),
             CustomFieldsPanel(),
             RelatedObjectsPanel(),
             RelatedObjectsPanel(),
+            ImageAttachmentsPanel(),
         ],
         ],
     )
     )