Fixes #3668: search address by DNS name when assigning

This commit is contained in:
Saria Hajjar 2020-01-09 10:00:02 +00:00
parent 770f4c962c
commit 1cdbfd6d60
5 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,7 @@
* [#2050](https://github.com/netbox-community/netbox/issues/2050) - Preview image attachments when hovering the link
* [#3187](https://github.com/netbox-community/netbox/issues/3187) - Add rack selection field to rack elevations
* [#3668](https://github.com/netbox-community/netbox/issues/3668) - Search by DNS name when assigning IP address
## Bug Fixes

View File

@ -943,7 +943,12 @@ class IPAddressAssignForm(BootstrapMixin, forms.Form):
)
)
address = forms.CharField(
label='IP Address'
label='IP Address',
required=False,
)
dns_name = forms.CharField(
label='DNS Name',
required=False,
)

View File

@ -373,7 +373,7 @@ class IPAddressAssignTable(BaseTable):
class Meta(BaseTable.Meta):
model = IPAddress
fields = ('address', 'vrf', 'status', 'role', 'tenant', 'parent', 'interface', 'description')
fields = ('address', 'dns_name', 'vrf', 'status', 'role', 'tenant', 'parent', 'interface', 'description')
orderable = False

View File

@ -745,6 +745,7 @@ class IPAddressAssignView(PermissionRequiredMixin, View):
).filter(
vrf=form.cleaned_data['vrf'],
address__istartswith=form.cleaned_data['address'],
dns_name__icontains=form.cleaned_data['dns_name'],
)[:100] # Limit to 100 results
table = tables.IPAddressAssignTable(queryset)

View File

@ -26,6 +26,7 @@
<div class="panel-body">
{% render_field form.vrf %}
{% render_field form.address %}
{% render_field form.dns_name %}
</div>
</div>
</div>