1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduce InlineFields for rendering fields side-by-side

This commit is contained in:
Jeremy Stretch
2024-03-12 15:44:35 -04:00
parent 93c9f8cc04
commit f585c36d86
7 changed files with 79 additions and 106 deletions

View File

@ -16,6 +16,7 @@ from utilities.forms.fields import (
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, JSONField,
NumericArrayField, SlugField,
)
from utilities.forms.rendering import InlineFields
from utilities.forms.widgets import APISelect, ClearableFileInput, HTMXSelect, NumberWithOptions, SelectWithPK
from virtualization.models import Cluster
from wireless.models import WirelessLAN, WirelessLANGroup
@ -227,6 +228,22 @@ class RackForm(TenancyForm, NetBoxModelForm):
)
comments = CommentField()
fieldsets = (
(_('Rack'), ('site', 'location', 'name', 'status', 'role', 'description', 'tags')),
(_('Inventory Control'), ('facility_id', 'serial', 'asset_tag')),
(_('Tenancy'), ('tenant_group', 'tenant')),
(_('Dimensions'), (
'type',
'width',
'starting_unit',
'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),
'mounting_depth',
'desc_units',
)),
)
class Meta:
model = Rack
fields = [