From 7d8a6d449da6d1c738e852dcaf4b3d604a3ea727 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 2 Dec 2021 12:08:12 -0500 Subject: [PATCH] netbox-community/netbox#6905: Add tenant as search field to vlan prefix assign form --- netbox/ipam/forms/models.py | 8 +++++++- netbox/templates/ipam/prefix_assign.html | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/netbox/ipam/forms/models.py b/netbox/ipam/forms/models.py index c15a19fb0f5..356eb667d6e 100644 --- a/netbox/ipam/forms/models.py +++ b/netbox/ipam/forms/models.py @@ -7,6 +7,7 @@ from ipam.constants import * from ipam.models import * from tenancy.forms import TenancyForm +from tenancy.models import Tenant from utilities.forms import ( BootstrapMixin, ContentTypeChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, NumericArrayField, SlugField, StaticSelect, StaticSelectMultiple, @@ -208,7 +209,12 @@ class PrefixAssignForm(BootstrapMixin, forms.Form): site_id = DynamicModelChoiceField( queryset=Site.objects.all(), required=False, - label='Site' + label='Site', + ) + tenant_id = DynamicModelChoiceField( + queryset=Tenant.objects.all(), + required=False, + label='Tenant', ) vrf_id = DynamicModelChoiceField( queryset=VRF.objects.all(), diff --git a/netbox/templates/ipam/prefix_assign.html b/netbox/templates/ipam/prefix_assign.html index fafcfde10f5..e09b5db2d85 100644 --- a/netbox/templates/ipam/prefix_assign.html +++ b/netbox/templates/ipam/prefix_assign.html @@ -20,6 +20,7 @@
Select Prefix
{% render_field form.site_id %} + {% render_field form.tenant_id %} {% render_field form.vrf_id %} {% render_field form.q %}