mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Update object edit template to use fieldsets where possible
This commit is contained in:
@@ -104,6 +104,10 @@ class ClusterForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
fields = (
|
||||
'name', 'type', 'group', 'tenant', 'region', 'site', 'comments', 'tags',
|
||||
)
|
||||
fieldsets = (
|
||||
('Cluster', ('name', 'type', 'group', 'region', 'site')),
|
||||
('Tenancy', ('tenant_group', 'tenant')),
|
||||
)
|
||||
|
||||
|
||||
class ClusterCSVForm(CustomFieldModelCSVForm):
|
||||
@@ -321,6 +325,13 @@ class VirtualMachineForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
'name', 'status', 'cluster_group', 'cluster', 'role', 'tenant_group', 'tenant', 'platform', 'primary_ip4',
|
||||
'primary_ip6', 'vcpus', 'memory', 'disk', 'comments', 'tags', 'local_context_data',
|
||||
]
|
||||
fieldsets = (
|
||||
('Virtual Machine', ('name', 'role', 'status')),
|
||||
('Cluster', ('cluster_group', 'cluster')),
|
||||
('Management', ('platform', 'primary_ip4', 'primary_ip6')),
|
||||
('Resources', ('vcpus', 'memory', 'disk')),
|
||||
('Config Context', ('local_context_data',)),
|
||||
)
|
||||
help_texts = {
|
||||
'local_context_data': "Local config context data overwrites all sources contexts in the final rendered "
|
||||
"config context",
|
||||
|
@@ -114,7 +114,6 @@ class ClusterView(generic.ObjectView):
|
||||
|
||||
|
||||
class ClusterEditView(generic.ObjectEditView):
|
||||
template_name = 'virtualization/cluster_edit.html'
|
||||
queryset = Cluster.objects.all()
|
||||
model_form = forms.ClusterForm
|
||||
|
||||
@@ -276,7 +275,6 @@ class VirtualMachineConfigContextView(ObjectConfigContextView):
|
||||
class VirtualMachineEditView(generic.ObjectEditView):
|
||||
queryset = VirtualMachine.objects.all()
|
||||
model_form = forms.VirtualMachineForm
|
||||
template_name = 'virtualization/virtualmachine_edit.html'
|
||||
|
||||
|
||||
class VirtualMachineDeleteView(generic.ObjectDeleteView):
|
||||
|
Reference in New Issue
Block a user