mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
* Add racktype_count annotation to list view queryset, create the LinkedCountColumn in ManufacturerTable * Add Manufacturer field to RackTypeFilterForm
This commit is contained in:
parent
c324d23634
commit
11514bfb21
@ -303,7 +303,7 @@ class RackTypeFilterForm(RackBaseFilterForm):
|
|||||||
model = RackType
|
model = RackType
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
FieldSet('form_factor', 'width', 'u_height', name=_('Rack Type')),
|
FieldSet('manufacturer_id', 'form_factor', 'width', 'u_height', name=_('Rack Type')),
|
||||||
FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
|
FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
|
||||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||||
)
|
)
|
||||||
|
@ -31,6 +31,11 @@ class ManufacturerTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
verbose_name=_('Name'),
|
verbose_name=_('Name'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
|
racktype_count = columns.LinkedCountColumn(
|
||||||
|
viewname='dcim:racktype_list',
|
||||||
|
url_params={'manufacturer_id': 'pk'},
|
||||||
|
verbose_name=_('Rack Types')
|
||||||
|
)
|
||||||
devicetype_count = columns.LinkedCountColumn(
|
devicetype_count = columns.LinkedCountColumn(
|
||||||
viewname='dcim:devicetype_list',
|
viewname='dcim:devicetype_list',
|
||||||
url_params={'manufacturer_id': 'pk'},
|
url_params={'manufacturer_id': 'pk'},
|
||||||
@ -58,12 +63,12 @@ class ManufacturerTable(ContactsColumnMixin, NetBoxTable):
|
|||||||
class Meta(NetBoxTable.Meta):
|
class Meta(NetBoxTable.Meta):
|
||||||
model = models.Manufacturer
|
model = models.Manufacturer
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'name', 'devicetype_count', 'moduletype_count', 'inventoryitem_count', 'platform_count',
|
'pk', 'id', 'name', 'racktype_count', 'devicetype_count', 'moduletype_count', 'inventoryitem_count',
|
||||||
'description', 'slug', 'tags', 'contacts', 'actions', 'created', 'last_updated',
|
'platform_count', 'description', 'slug', 'tags', 'contacts', 'actions', 'created', 'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'devicetype_count', 'moduletype_count', 'inventoryitem_count', 'platform_count',
|
'pk', 'name', 'racktype_count', 'devicetype_count', 'moduletype_count', 'inventoryitem_count',
|
||||||
'description', 'slug',
|
'platform_count', 'description', 'slug',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -964,6 +964,7 @@ class RackReservationBulkDeleteView(generic.BulkDeleteView):
|
|||||||
@register_model_view(Manufacturer, 'list', path='', detail=False)
|
@register_model_view(Manufacturer, 'list', path='', detail=False)
|
||||||
class ManufacturerListView(generic.ObjectListView):
|
class ManufacturerListView(generic.ObjectListView):
|
||||||
queryset = Manufacturer.objects.annotate(
|
queryset = Manufacturer.objects.annotate(
|
||||||
|
racktype_count=count_related(RackType, 'manufacturer'),
|
||||||
devicetype_count=count_related(DeviceType, 'manufacturer'),
|
devicetype_count=count_related(DeviceType, 'manufacturer'),
|
||||||
moduletype_count=count_related(ModuleType, 'manufacturer'),
|
moduletype_count=count_related(ModuleType, 'manufacturer'),
|
||||||
inventoryitem_count=count_related(InventoryItem, 'manufacturer'),
|
inventoryitem_count=count_related(InventoryItem, 'manufacturer'),
|
||||||
|
Loading…
Reference in New Issue
Block a user