netbox-community/netbox#6905: Add tenant as search field to vlan prefix assign form

This commit is contained in:
Rhys Barrie 2021-12-02 12:08:12 -05:00
parent 8b510b3b5e
commit 7d8a6d449d
2 changed files with 8 additions and 1 deletions

View File

@ -7,6 +7,7 @@ from extras.models import Tag
from ipam.constants import * from ipam.constants import *
from ipam.models import * from ipam.models import *
from tenancy.forms import TenancyForm from tenancy.forms import TenancyForm
from tenancy.models import Tenant
from utilities.forms import ( from utilities.forms import (
BootstrapMixin, ContentTypeChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, BootstrapMixin, ContentTypeChoiceField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField,
NumericArrayField, SlugField, StaticSelect, StaticSelectMultiple, NumericArrayField, SlugField, StaticSelect, StaticSelectMultiple,
@ -208,7 +209,12 @@ class PrefixAssignForm(BootstrapMixin, forms.Form):
site_id = DynamicModelChoiceField( site_id = DynamicModelChoiceField(
queryset=Site.objects.all(), queryset=Site.objects.all(),
required=False, required=False,
label='Site' label='Site',
)
tenant_id = DynamicModelChoiceField(
queryset=Tenant.objects.all(),
required=False,
label='Tenant',
) )
vrf_id = DynamicModelChoiceField( vrf_id = DynamicModelChoiceField(
queryset=VRF.objects.all(), queryset=VRF.objects.all(),

View File

@ -20,6 +20,7 @@
<div class="field-group"> <div class="field-group">
<h6>Select Prefix</h6> <h6>Select Prefix</h6>
{% render_field form.site_id %} {% render_field form.site_id %}
{% render_field form.tenant_id %}
{% render_field form.vrf_id %} {% render_field form.vrf_id %}
{% render_field form.q %} {% render_field form.q %}
</div> </div>