From cef8204f4024d49eb99720fac975a70475cffb7f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 25 Feb 2021 14:03:14 -0500 Subject: [PATCH] Merge tags fields with primary object fields in form display --- netbox/circuits/forms.py | 4 ++-- netbox/dcim/forms.py | 10 +++++----- netbox/ipam/forms.py | 8 ++++---- netbox/templates/dcim/device_edit.html | 7 +------ netbox/templates/dcim/interface_edit.html | 7 +------ netbox/templates/dcim/rack_edit.html | 14 +++++++------- netbox/templates/generic/object_edit.html | 8 -------- netbox/templates/ipam/ipaddress_bulk_add.html | 7 +------ netbox/templates/ipam/ipaddress_edit.html | 7 +------ netbox/templates/ipam/service_edit.html | 7 +------ netbox/templates/secrets/secret_edit.html | 7 +------ .../templates/virtualization/vminterface_edit.html | 7 +------ netbox/tenancy/forms.py | 2 +- netbox/virtualization/forms.py | 4 ++-- 14 files changed, 28 insertions(+), 71 deletions(-) diff --git a/netbox/circuits/forms.py b/netbox/circuits/forms.py index 8c35d972d..6a2577edb 100644 --- a/netbox/circuits/forms.py +++ b/netbox/circuits/forms.py @@ -34,7 +34,7 @@ class ProviderForm(BootstrapMixin, CustomFieldModelForm): 'name', 'slug', 'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'comments', 'tags', ] fieldsets = ( - ('Provider', ('name', 'slug', 'asn')), + ('Provider', ('name', 'slug', 'asn', 'tags')), ('Support Info', ('account', 'portal_url', 'noc_contact', 'admin_contact')), ) widgets = { @@ -176,7 +176,7 @@ class CircuitForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'comments', 'tags', ] fieldsets = ( - ('Circuit', ('provider', 'cid', 'type', 'status', 'install_date', 'commit_rate', 'description')), + ('Circuit', ('provider', 'cid', 'type', 'status', 'install_date', 'commit_rate', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) help_texts = { diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 30c92bad8..3428dec57 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -232,7 +232,7 @@ class SiteForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'contact_email', 'comments', 'tags', ] fieldsets = ( - ('Site', ('name', 'slug', 'status', 'region', 'facility', 'asn', 'time_zone', 'description')), + ('Site', ('name', 'slug', 'status', 'region', 'facility', 'asn', 'time_zone', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ('Contact Info', ( 'physical_address', 'shipping_address', 'latitude', 'longitude', 'contact_name', 'contact_phone', @@ -791,7 +791,7 @@ class RackReservationForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'region', 'site', 'rack_group', 'rack', 'units', 'user', 'tenant_group', 'tenant', 'description', 'tags', ] fieldsets = ( - ('Reservation', ('region', 'site', 'rack_group', 'rack', 'units', 'user', 'description')), + ('Reservation', ('region', 'site', 'rack_group', 'rack', 'units', 'user', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) @@ -955,7 +955,7 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldModelForm): ] fieldsets = ( ('Device Type', ( - 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', + 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'tags', )), ('Images', ('front_image', 'rear_image')), ) @@ -4401,7 +4401,7 @@ class PowerPanelForm(BootstrapMixin, CustomFieldModelForm): 'region', 'site', 'rack_group', 'name', 'tags', ] fieldsets = ( - ('Power Panel', ('region', 'site', 'rack_group', 'name')), + ('Power Panel', ('region', 'site', 'rack_group', 'name', 'tags')), ) @@ -4543,7 +4543,7 @@ class PowerFeedForm(BootstrapMixin, CustomFieldModelForm): ] fieldsets = ( ('Power Panel', ('region', 'site', 'power_panel')), - ('Power Feed', ('rack', 'name', 'status', 'type')), + ('Power Feed', ('rack', 'name', 'status', 'type', 'tags')), ('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')), ) widgets = { diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index 0c8f7de24..7e45c30b3 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -51,7 +51,7 @@ class VRFForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'tags', ] fieldsets = ( - ('VRF', ('name', 'rd', 'enforce_unique', 'description')), + ('VRF', ('name', 'rd', 'enforce_unique', 'description', 'tags')), ('Route Targets', ('import_targets', 'export_targets')), ('Tenancy', ('tenant_group', 'tenant')), ) @@ -246,7 +246,7 @@ class AggregateForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'prefix', 'rir', 'date_added', 'description', 'tenant_group', 'tenant', 'tags', ] fieldsets = ( - ('Aggregate', ('prefix', 'rir', 'date_added', 'description')), + ('Aggregate', ('prefix', 'rir', 'date_added', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) help_texts = { @@ -414,7 +414,7 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'tags', ] fieldsets = ( - ('Prefix', ('prefix', 'status', 'vrf', 'role', 'description', 'is_pool')), + ('Prefix', ('prefix', 'status', 'vrf', 'role', 'is_pool', 'description', 'tags')), ('Site/VLAN Assignment', ('region', 'site', 'vlan_group', 'vlan')), ('Tenancy', ('tenant_group', 'tenant')), ) @@ -1178,7 +1178,7 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'site', 'group', 'vid', 'name', 'status', 'role', 'description', 'tenant_group', 'tenant', 'tags', ] fieldsets = ( - ('VLAN', ('vid', 'name', 'status', 'role', 'description')), + ('VLAN', ('vid', 'name', 'status', 'role', 'description', 'tags')), ('Assignment', ('region', 'site', 'group')), ('Tenancy', ('tenant_group', 'tenant')), ) diff --git a/netbox/templates/dcim/device_edit.html b/netbox/templates/dcim/device_edit.html index 023b7e43c..31b9dddb0 100644 --- a/netbox/templates/dcim/device_edit.html +++ b/netbox/templates/dcim/device_edit.html @@ -7,6 +7,7 @@
{% render_field form.name %} {% render_field form.device_role %} + {% render_field form.tags %}
@@ -92,12 +93,6 @@ {% render_field form.local_context_data %}
-
-
Tags
-
- {% render_field form.tags %} -
-
Comments
diff --git a/netbox/templates/dcim/interface_edit.html b/netbox/templates/dcim/interface_edit.html index 1f549febd..a1eb2cee1 100644 --- a/netbox/templates/dcim/interface_edit.html +++ b/netbox/templates/dcim/interface_edit.html @@ -24,6 +24,7 @@ {% render_field form.mtu %} {% render_field form.mgmt_only %} {% render_field form.description %} + {% render_field form.tags %}
@@ -34,12 +35,6 @@ {% render_field form.tagged_vlans %}
-
-
Tags
-
- {% render_field form.tags %} -
-
{% endblock %} {% block buttons %} diff --git a/netbox/templates/dcim/rack_edit.html b/netbox/templates/dcim/rack_edit.html index 9ce242191..8d23467e3 100644 --- a/netbox/templates/dcim/rack_edit.html +++ b/netbox/templates/dcim/rack_edit.html @@ -9,9 +9,15 @@ {% render_field form.site %} {% render_field form.group %} {% render_field form.name %} - {% render_field form.facility_id %} {% render_field form.status %} {% render_field form.role %} + {% render_field form.tags %} + + +
+
Inventory Control
+
+ {% render_field form.facility_id %} {% render_field form.serial %} {% render_field form.asset_tag %}
@@ -52,12 +58,6 @@
{% endif %} -
-
Tags
-
- {% render_field form.tags %} -
-
Comments
diff --git a/netbox/templates/generic/object_edit.html b/netbox/templates/generic/object_edit.html index 7056256ec..a07b2dfaf 100644 --- a/netbox/templates/generic/object_edit.html +++ b/netbox/templates/generic/object_edit.html @@ -50,14 +50,6 @@
{% endif %} - {% if form.tags %} -
-
Tags
-
- {% render_field form.tags %} -
-
- {% endif %} {% if form.comments %}
Comments
diff --git a/netbox/templates/ipam/ipaddress_bulk_add.html b/netbox/templates/ipam/ipaddress_bulk_add.html index f019d48b8..db103b43b 100644 --- a/netbox/templates/ipam/ipaddress_bulk_add.html +++ b/netbox/templates/ipam/ipaddress_bulk_add.html @@ -17,6 +17,7 @@ {% render_field model_form.role %} {% render_field model_form.vrf %} {% render_field model_form.description %} + {% render_field model_form.tags %}
@@ -26,12 +27,6 @@ {% render_field model_form.tenant %}
-
-
Tags
-
- {% render_field model_form.tags %} -
-
{% if model_form.custom_fields %}
Custom Fields
diff --git a/netbox/templates/ipam/ipaddress_edit.html b/netbox/templates/ipam/ipaddress_edit.html index eb15a3059..33e58ce09 100644 --- a/netbox/templates/ipam/ipaddress_edit.html +++ b/netbox/templates/ipam/ipaddress_edit.html @@ -19,6 +19,7 @@ {% render_field form.vrf %} {% render_field form.dns_name %} {% render_field form.description %} + {% render_field form.tags %}
@@ -78,12 +79,6 @@ {% render_field form.nat_inside %}
-
-
Tags
-
- {% render_field form.tags %} -
-
{% if form.custom_fields %}
Custom Fields
diff --git a/netbox/templates/ipam/service_edit.html b/netbox/templates/ipam/service_edit.html index 8d6fde9e9..7cc74f450 100644 --- a/netbox/templates/ipam/service_edit.html +++ b/netbox/templates/ipam/service_edit.html @@ -31,6 +31,7 @@
{% render_field form.ipaddresses %} {% render_field form.description %} + {% render_field form.tags %} {% if form.custom_fields %} @@ -41,10 +42,4 @@ {% endif %} -
-
Tags
-
- {% render_field form.tags %} -
-
{% endblock %} diff --git a/netbox/templates/secrets/secret_edit.html b/netbox/templates/secrets/secret_edit.html index 4e2d78042..b7e7ab785 100644 --- a/netbox/templates/secrets/secret_edit.html +++ b/netbox/templates/secrets/secret_edit.html @@ -39,6 +39,7 @@ {% render_field form.role %} {% render_field form.name %} {% render_field form.userkeys %} + {% render_field form.tags %}
@@ -72,12 +73,6 @@
{% endif %} -
-
Tags
-
- {% render_field form.tags %} -
-
diff --git a/netbox/templates/virtualization/vminterface_edit.html b/netbox/templates/virtualization/vminterface_edit.html index d1fe6d104..d4869aaf9 100644 --- a/netbox/templates/virtualization/vminterface_edit.html +++ b/netbox/templates/virtualization/vminterface_edit.html @@ -20,6 +20,7 @@ {% render_field form.mac_address %} {% render_field form.mtu %} {% render_field form.description %} + {% render_field form.tags %}
@@ -30,12 +31,6 @@ {% render_field form.tagged_vlans %}
-
-
Tags
-
- {% render_field form.tags %} -
-
{% endblock %} {% block buttons %} diff --git a/netbox/tenancy/forms.py b/netbox/tenancy/forms.py index ee9adefc0..97e72bb02 100644 --- a/netbox/tenancy/forms.py +++ b/netbox/tenancy/forms.py @@ -65,7 +65,7 @@ class TenantForm(BootstrapMixin, CustomFieldModelForm): 'name', 'slug', 'group', 'description', 'comments', 'tags', ) fieldsets = ( - ('Tenant', ('name', 'slug', 'group', 'description')), + ('Tenant', ('name', 'slug', 'group', 'description', 'tags')), ) diff --git a/netbox/virtualization/forms.py b/netbox/virtualization/forms.py index 7e0c45378..addfb05cd 100644 --- a/netbox/virtualization/forms.py +++ b/netbox/virtualization/forms.py @@ -105,7 +105,7 @@ class ClusterForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'name', 'type', 'group', 'tenant', 'region', 'site', 'comments', 'tags', ) fieldsets = ( - ('Cluster', ('name', 'type', 'group', 'region', 'site')), + ('Cluster', ('name', 'type', 'group', 'region', 'site', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) @@ -326,7 +326,7 @@ class VirtualMachineForm(BootstrapMixin, TenancyForm, CustomFieldModelForm): 'primary_ip6', 'vcpus', 'memory', 'disk', 'comments', 'tags', 'local_context_data', ] fieldsets = ( - ('Virtual Machine', ('name', 'role', 'status')), + ('Virtual Machine', ('name', 'role', 'status', 'tags')), ('Cluster', ('cluster_group', 'cluster')), ('Management', ('platform', 'primary_ip4', 'primary_ip6')), ('Resources', ('vcpus', 'memory', 'disk')),