Merge branch 'develop' into develop-2.1

Conflicts:
	netbox/ipam/models.py
	netbox/netbox/settings.py
	netbox/templates/dcim/inc/interface.html
This commit is contained in:
Jeremy Stretch
2017-07-06 13:27:13 -04:00
18 changed files with 104 additions and 93 deletions

View File

@@ -646,16 +646,23 @@ class IPAddressCSVForm(forms.ModelForm):
# Set interface
if self.cleaned_data['device'] and self.cleaned_data['interface_name']:
self.instance.interface = Interface.objects.get(device=self.cleaned_data['device'],
name=self.cleaned_data['interface_name'])
self.instance.interface = Interface.objects.get(
device=self.cleaned_data['device'],
name=self.cleaned_data['interface_name']
)
ipaddress = super(IPAddressCSVForm, self).save(*args, **kwargs)
# Set as primary for device
if self.cleaned_data['is_primary']:
device = self.cleaned_data['device']
if self.instance.address.version == 4:
self.instance.primary_ip4_for = self.cleaned_data['device']
device.primary_ip4 = ipaddress
elif self.instance.address.version == 6:
self.instance.primary_ip6_for = self.cleaned_data['device']
device.primary_ip6 = ipaddress
device.save()
return super(IPAddressCSVForm, self).save(*args, **kwargs)
return ipaddress
class IPAddressBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):