mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Replace custom form templates with TabbedFieldGroups
This commit is contained in:
@@ -16,7 +16,7 @@ from utilities.forms.fields import (
|
||||
CommentField, ContentTypeChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField,
|
||||
SlugField,
|
||||
)
|
||||
from utilities.forms.rendering import ObjectAttribute
|
||||
from utilities.forms.rendering import InlineFields, ObjectAttribute, TabbedFieldGroups
|
||||
from utilities.forms.widgets import DatePicker
|
||||
from virtualization.models import Cluster, ClusterGroup, VirtualMachine, VMInterface
|
||||
|
||||
@@ -308,6 +308,20 @@ class IPAddressForm(TenancyForm, NetBoxModelForm):
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('IP Address'), ('address', 'status', 'role', 'vrf', 'dns_name', 'description', 'tags')),
|
||||
(_('Tenancy'), ('tenant_group', 'tenant')),
|
||||
(_('Assignment'), (
|
||||
TabbedFieldGroups(
|
||||
(_('Device'), 'interface'),
|
||||
(_('Virtual Machine'), 'vminterface'),
|
||||
(_('FHRP Group'), 'fhrpgroup'),
|
||||
),
|
||||
'primary_for_parent',
|
||||
)),
|
||||
(_('NAT IP (Inside)'), ('nat_inside',)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = IPAddress
|
||||
fields = [
|
||||
@@ -709,6 +723,20 @@ class ServiceForm(NetBoxModelForm):
|
||||
)
|
||||
comments = CommentField()
|
||||
|
||||
fieldsets = (
|
||||
(_('Service'), (
|
||||
TabbedFieldGroups(
|
||||
(_('Device'), 'device'),
|
||||
(_('Virtual Machine'), 'virtual_machine'),
|
||||
),
|
||||
'name',
|
||||
InlineFields(_('Port(s)'), 'protocol', 'ports'),
|
||||
'ipaddresses',
|
||||
'description',
|
||||
'tags',
|
||||
)),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Service
|
||||
fields = [
|
||||
@@ -723,6 +751,22 @@ class ServiceCreateForm(ServiceForm):
|
||||
required=False
|
||||
)
|
||||
|
||||
fieldsets = (
|
||||
(_('Service'), (
|
||||
TabbedFieldGroups(
|
||||
(_('Device'), 'device'),
|
||||
(_('Virtual Machine'), 'virtual_machine'),
|
||||
),
|
||||
TabbedFieldGroups(
|
||||
(_('From Template'), 'service_template'),
|
||||
(_('Custom'), 'name', 'protocol', 'ports'),
|
||||
),
|
||||
'ipaddresses',
|
||||
'description',
|
||||
'tags',
|
||||
)),
|
||||
)
|
||||
|
||||
class Meta(ServiceForm.Meta):
|
||||
fields = [
|
||||
'device', 'virtual_machine', 'service_template', 'name', 'protocol', 'ports', 'ipaddresses', 'description',
|
||||
|
Reference in New Issue
Block a user