mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-27 03:09:31 +02:00
21550 call snapshot() before save
This commit is contained in:
@@ -1386,6 +1386,7 @@ class MACAddressImportForm(PrimaryModelImportForm):
|
|||||||
|
|
||||||
# Assign the MAC address as primary for its interface, if designated as such
|
# Assign the MAC address as primary for its interface, if designated as such
|
||||||
if interface and self.cleaned_data['is_primary'] and self.instance.pk:
|
if interface and self.cleaned_data['is_primary'] and self.instance.pk:
|
||||||
|
interface.snapshot()
|
||||||
interface.primary_mac_address = self.instance
|
interface.primary_mac_address = self.instance
|
||||||
interface.save()
|
interface.save()
|
||||||
|
|
||||||
|
|||||||
@@ -2733,6 +2733,7 @@ class DeviceBulkImportView(generic.BulkImportView):
|
|||||||
# For child devices, save the reverse relation to the parent device bay
|
# For child devices, save the reverse relation to the parent device bay
|
||||||
if parent_bay:
|
if parent_bay:
|
||||||
device_bay = parent_bay
|
device_bay = parent_bay
|
||||||
|
device_bay.snapshot()
|
||||||
device_bay.installed_device = obj
|
device_bay.installed_device = obj
|
||||||
device_bay.save()
|
device_bay.save()
|
||||||
|
|
||||||
@@ -4099,9 +4100,11 @@ class VirtualChassisEditView(ObjectPermissionRequiredMixin, GetReturnURLMixin, V
|
|||||||
members = formset.save(commit=False)
|
members = formset.save(commit=False)
|
||||||
devices = Device.objects.filter(pk__in=[m.pk for m in members])
|
devices = Device.objects.filter(pk__in=[m.pk for m in members])
|
||||||
for device in devices:
|
for device in devices:
|
||||||
|
device.snapshot()
|
||||||
device.vc_position = None
|
device.vc_position = None
|
||||||
device.save()
|
device.save()
|
||||||
for member in members:
|
for member in members:
|
||||||
|
member.snapshot()
|
||||||
member.save()
|
member.save()
|
||||||
|
|
||||||
return redirect(virtual_chassis.get_absolute_url())
|
return redirect(virtual_chassis.get_absolute_url())
|
||||||
|
|||||||
@@ -424,6 +424,7 @@ class IPAddressImportForm(PrimaryModelImportForm):
|
|||||||
# Set as primary for device/VM
|
# Set as primary for device/VM
|
||||||
if self.cleaned_data.get('is_primary') is not None:
|
if self.cleaned_data.get('is_primary') is not None:
|
||||||
parent = self.cleaned_data.get('device') or self.cleaned_data.get('virtual_machine')
|
parent = self.cleaned_data.get('device') or self.cleaned_data.get('virtual_machine')
|
||||||
|
parent.snapshot()
|
||||||
if self.instance.address.version == 4:
|
if self.instance.address.version == 4:
|
||||||
parent.primary_ip4 = ipaddress if self.cleaned_data.get('is_primary') else None
|
parent.primary_ip4 = ipaddress if self.cleaned_data.get('is_primary') else None
|
||||||
elif self.instance.address.version == 6:
|
elif self.instance.address.version == 6:
|
||||||
@@ -433,6 +434,7 @@ class IPAddressImportForm(PrimaryModelImportForm):
|
|||||||
# Set as OOB for device
|
# Set as OOB for device
|
||||||
if self.cleaned_data.get('is_oob') is not None:
|
if self.cleaned_data.get('is_oob') is not None:
|
||||||
parent = self.cleaned_data.get('device')
|
parent = self.cleaned_data.get('device')
|
||||||
|
parent.snapshot()
|
||||||
parent.oob_ip = ipaddress if self.cleaned_data.get('is_oob') else None
|
parent.oob_ip = ipaddress if self.cleaned_data.get('is_oob') else None
|
||||||
parent.save()
|
parent.save()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user