mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Merge branch 'develop' into 9665-rack-elevation-sorting
This commit is contained in:
@@ -526,9 +526,8 @@ class PrefixIPAddressesView(generic.ObjectChildrenView):
|
||||
return parent.get_child_ips().restrict(request.user, 'view').prefetch_related('vrf', 'tenant', 'tenant__group')
|
||||
|
||||
def prep_table_data(self, request, queryset, parent):
|
||||
if not request.GET.get('q'):
|
||||
if not request.GET.get('q') and not request.GET.get('sort'):
|
||||
return add_available_ipaddresses(parent.prefix, queryset, parent.is_pool)
|
||||
|
||||
return queryset
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
|
@@ -46,10 +46,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Rack</th>
|
||||
<td>
|
||||
<td class="position-relative">
|
||||
{% if object.rack %}
|
||||
{{ object.rack|linkify }}
|
||||
<div class="float-end noprint">
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
|
||||
<a href="{{ object.rack.get_absolute_url }}?device={{ object.pk }}" class="btn btn-primary btn-sm" title="Highlight device">
|
||||
<i class="mdi mdi-view-day-outline"></i>
|
||||
</a>
|
||||
|
@@ -58,9 +58,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Racks</th>
|
||||
<td>
|
||||
<td class="position-relative">
|
||||
{% if rack_count %}
|
||||
<div class="float-end noprint">
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
|
||||
<a href="{% url 'dcim:rack_elevation_list' %}?location_id={{ object.pk }}" class="btn btn-sm btn-primary" title="View elevations">
|
||||
<i class="mdi mdi-server"></i>
|
||||
</a>
|
||||
|
@@ -85,11 +85,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Physical Address</th>
|
||||
<td>
|
||||
<td class="position-relative">
|
||||
{% if object.physical_address %}
|
||||
<div class="float-end noprint">
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.physical_address|urlencode }}" target="_blank" class="btn btn-primary btn-sm">
|
||||
<i class="mdi mdi-map-marker"></i> Map It
|
||||
<i class="mdi mdi-map-marker"></i> Map
|
||||
</a>
|
||||
</div>
|
||||
<span>{{ object.physical_address|linebreaksbr }}</span>
|
||||
@@ -104,9 +104,9 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">GPS Coordinates</th>
|
||||
<td>
|
||||
<td class="position-relative">
|
||||
{% if object.latitude and object.longitude %}
|
||||
<div class="float-end noprint">
|
||||
<div class="position-absolute top-50 end-0 translate-middle-y noprint">
|
||||
<a href="{{ config.MAPS_URL }}{{ object.latitude }},{{ object.longitude }}" target="_blank" class="btn btn-primary btn-sm">
|
||||
<i class="mdi mdi-map-marker"></i> Map It
|
||||
</a>
|
||||
|
@@ -368,9 +368,14 @@ class VirtualMachine(NetBoxModel, ConfigContextModel):
|
||||
|
||||
# Validate primary IP addresses
|
||||
interfaces = self.interfaces.all()
|
||||
for field in ['primary_ip4', 'primary_ip6']:
|
||||
for family in (4, 6):
|
||||
field = f'primary_ip{family}'
|
||||
ip = getattr(self, field)
|
||||
if ip is not None:
|
||||
if ip.address.version != family:
|
||||
raise ValidationError({
|
||||
field: f"Must be an IPv{family} address. ({ip} is an IPv{ip.address.version} address.)",
|
||||
})
|
||||
if ip.assigned_object in interfaces:
|
||||
pass
|
||||
elif ip.nat_inside is not None and ip.nat_inside.assigned_object in interfaces:
|
||||
|
Reference in New Issue
Block a user