Merge branch 'develop' into 568-csv-import-cf

This commit is contained in:
hSaria 2020-01-17 11:47:01 +00:00 committed by GitHub
commit b11224a8b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# v2.7.1 (FUTURE) # v2.7.2 (FUTURE)
## Enhancements ## Enhancements
@ -6,6 +6,16 @@
--- ---
# v2.7.1 (2020-01-16)
## Bug Fixes
* [#3941](https://github.com/netbox-community/netbox/issues/3941) - Fixed exception when attempting to assign IP to interface
* [#3943](https://github.com/netbox-community/netbox/issues/3943) - Prevent rack elevation links from opening new tabs/windows
* [#3944](https://github.com/netbox-community/netbox/issues/3944) - Fix AttributeError exception when viewing prefixes list
---
# v2.7.0 (2020-01-16) # v2.7.0 (2020-01-16)
**Note:** This release completely removes the topology map feature ([#2745](https://github.com/netbox-community/netbox/issues/2745)). **Note:** This release completely removes the topology map feature ([#2745](https://github.com/netbox-community/netbox/issues/2745)).

View File

@ -390,7 +390,9 @@ class RackElevationHelperMixin:
color = device.device_role.color color = device.device_role.color
link = drawing.add( link = drawing.add(
drawing.a( drawing.a(
reverse('dcim:device', kwargs={'pk': device.pk}), fill='black' href=reverse('dcim:device', kwargs={'pk': device.pk}),
target='_top',
fill='black'
) )
) )
link.add(drawing.rect(start, end, fill='#{}'.format(color))) link.add(drawing.rect(start, end, fill='#{}'.format(color)))
@ -405,10 +407,13 @@ class RackElevationHelperMixin:
@staticmethod @staticmethod
def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_): def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_):
link = drawing.add( link = drawing.add(
drawing.a('{}?{}'.format( drawing.a(
href='{}?{}'.format(
reverse('dcim:device_add'), reverse('dcim:device_add'),
urlencode({'rack': rack.pk, 'site': rack.site.pk, 'face': face_id, 'position': id_}) urlencode({'rack': rack.pk, 'site': rack.site.pk, 'face': face_id, 'position': id_})
)) ),
target='_top'
)
) )
link.add(drawing.rect(start, end, class_=class_)) link.add(drawing.rect(start, end, class_=class_))
link.add(drawing.text("add device", insert=text, class_='add-device')) link.add(drawing.text("add device", insert=text, class_='add-device'))

View File

@ -1,6 +1,6 @@
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from netaddr import AddrFormatError, IPNetwork, IPAddress from netaddr import AddrFormatError, IPNetwork
from . import lookups from . import lookups
from .formfields import IPFormField from .formfields import IPFormField
@ -23,11 +23,9 @@ class BaseIPField(models.Field):
if not value: if not value:
return value return value
try: try:
if '/' in str(value): # Always return a netaddr.IPNetwork object. (netaddr.IPAddress does not provide a mask.)
return IPNetwork(value) return IPNetwork(value)
else: except AddrFormatError:
return IPAddress(value)
except AddrFormatError as e:
raise ValidationError("Invalid IP address format: {}".format(value)) raise ValidationError("Invalid IP address format: {}".format(value))
except (TypeError, ValueError) as e: except (TypeError, ValueError) as e:
raise ValidationError(e) raise ValidationError(e)

View File

@ -103,6 +103,10 @@ class NetHost(Lookup):
class NetIn(Lookup): class NetIn(Lookup):
lookup_name = 'net_in' lookup_name = 'net_in'
def get_prep_lookup(self):
# Don't cast the query value to a netaddr object, since it may or may not include a mask.
return self.rhs
def as_sql(self, qn, connection): def as_sql(self, qn, connection):
lhs, lhs_params = self.process_lhs(qn, connection) lhs, lhs_params = self.process_lhs(qn, connection)
rhs, rhs_params = self.process_rhs(qn, connection) rhs, rhs_params = self.process_rhs(qn, connection)

View File

@ -760,7 +760,7 @@ class IPAddressAssignView(PermissionRequiredMixin, View):
'vrf', 'tenant', 'interface__device', 'interface__virtual_machine' 'vrf', 'tenant', 'interface__device', 'interface__virtual_machine'
) )
# Limit to 100 results # Limit to 100 results
addresses = filters.IPAddressFilter(request.POST, addresses).qs[:100] addresses = filters.IPAddressFilterSet(request.POST, addresses).qs[:100]
table = tables.IPAddressAssignTable(addresses) table = tables.IPAddressAssignTable(addresses)
return render(request, 'ipam/ipaddress_assign.html', { return render(request, 'ipam/ipaddress_assign.html', {

View File

@ -12,7 +12,7 @@ from django.core.exceptions import ImproperlyConfigured
# Environment setup # Environment setup
# #
VERSION = '2.7.0' VERSION = '2.7.2-dev'
# Hostname # Hostname
HOSTNAME = platform.node() HOSTNAME = platform.node()