mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Merge pull request #3867 from hSaria/3668-address-assign-dns-filter
Fixes #3668: use `q` to search when assigning IP
This commit is contained in:
commit
fc1245c49d
@ -6,11 +6,13 @@
|
|||||||
* [#2050](https://github.com/netbox-community/netbox/issues/2050) - Preview image attachments when hovering the link
|
* [#2050](https://github.com/netbox-community/netbox/issues/2050) - Preview image attachments when hovering the link
|
||||||
* [#2113](https://github.com/netbox-community/netbox/issues/2113) - Allow NAPALM driver settings to be changed with request headers
|
* [#2113](https://github.com/netbox-community/netbox/issues/2113) - Allow NAPALM driver settings to be changed with request headers
|
||||||
* [#2589](https://github.com/netbox-community/netbox/issues/2589) - Toggle for showing available prefixes/ip addresses
|
* [#2589](https://github.com/netbox-community/netbox/issues/2589) - Toggle for showing available prefixes/ip addresses
|
||||||
|
* [#3009](https://github.com/netbox-community/netbox/issues/3009) - Search by description when assigning IP address
|
||||||
* [#3090](https://github.com/netbox-community/netbox/issues/3090) - Add filter field for device interfaces
|
* [#3090](https://github.com/netbox-community/netbox/issues/3090) - Add filter field for device interfaces
|
||||||
* [#3187](https://github.com/netbox-community/netbox/issues/3187) - Add rack selection field to rack elevations
|
* [#3187](https://github.com/netbox-community/netbox/issues/3187) - Add rack selection field to rack elevations
|
||||||
* [#3393](https://github.com/netbox-community/netbox/issues/3393) - Paginate the circuits at the provider details view
|
* [#3393](https://github.com/netbox-community/netbox/issues/3393) - Paginate the circuits at the provider details view
|
||||||
* [#3440](https://github.com/netbox-community/netbox/issues/3440) - Add total length to cable trace
|
* [#3440](https://github.com/netbox-community/netbox/issues/3440) - Add total length to cable trace
|
||||||
* [#3623](https://github.com/netbox-community/netbox/issues/3623) - Add word expansion during interface creation
|
* [#3623](https://github.com/netbox-community/netbox/issues/3623) - Add word expansion during interface creation
|
||||||
|
* [#3668](https://github.com/netbox-community/netbox/issues/3668) - Search by DNS name when assigning IP address
|
||||||
* [#3851](https://github.com/netbox-community/netbox/issues/3851) - Allow passing initial data to custom script forms
|
* [#3851](https://github.com/netbox-community/netbox/issues/3851) - Allow passing initial data to custom script forms
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
@ -933,7 +933,7 @@ class IPAddressBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEd
|
|||||||
|
|
||||||
|
|
||||||
class IPAddressAssignForm(BootstrapMixin, forms.Form):
|
class IPAddressAssignForm(BootstrapMixin, forms.Form):
|
||||||
vrf = forms.ModelChoiceField(
|
vrf_id = forms.ModelChoiceField(
|
||||||
queryset=VRF.objects.all(),
|
queryset=VRF.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
label='VRF',
|
label='VRF',
|
||||||
@ -942,8 +942,9 @@ class IPAddressAssignForm(BootstrapMixin, forms.Form):
|
|||||||
api_url="/api/ipam/vrfs/"
|
api_url="/api/ipam/vrfs/"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
address = forms.CharField(
|
q = forms.CharField(
|
||||||
label='IP Address'
|
required=False,
|
||||||
|
label='Search',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ class IPAddressAssignTable(BaseTable):
|
|||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
fields = ('address', 'vrf', 'status', 'role', 'tenant', 'parent', 'interface', 'description')
|
fields = ('address', 'dns_name', 'vrf', 'status', 'role', 'tenant', 'parent', 'interface', 'description')
|
||||||
orderable = False
|
orderable = False
|
||||||
|
|
||||||
|
|
||||||
|
@ -756,13 +756,12 @@ class IPAddressAssignView(PermissionRequiredMixin, View):
|
|||||||
|
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
|
|
||||||
queryset = IPAddress.objects.prefetch_related(
|
addresses = IPAddress.objects.prefetch_related(
|
||||||
'vrf', 'tenant', 'interface__device', 'interface__virtual_machine'
|
'vrf', 'tenant', 'interface__device', 'interface__virtual_machine'
|
||||||
).filter(
|
)
|
||||||
vrf=form.cleaned_data['vrf'],
|
# Limit to 100 results
|
||||||
address__istartswith=form.cleaned_data['address'],
|
addresses = filters.IPAddressFilter(request.POST, addresses).qs[:100]
|
||||||
)[:100] # Limit to 100 results
|
table = tables.IPAddressAssignTable(addresses)
|
||||||
table = tables.IPAddressAssignTable(queryset)
|
|
||||||
|
|
||||||
return render(request, 'ipam/ipaddress_assign.html', {
|
return render(request, 'ipam/ipaddress_assign.html', {
|
||||||
'form': form,
|
'form': form,
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><strong>Select IP Address</strong></div>
|
<div class="panel-heading"><strong>Select IP Address</strong></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{% render_field form.vrf %}
|
{% render_field form.vrf_id %}
|
||||||
{% render_field form.address %}
|
{% render_field form.q %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user