mirror of
				https://github.com/netbox-community/netbox.git
				synced 2024-05-10 07:54:54 +00:00 
			
		
		
		
	fixes #4647 - caching invalidation related to assinging new IP addresses to interfaces
This commit is contained in:
		@@ -5,6 +5,8 @@ v2.8.5 (FUTURE)
 | 
			
		||||
### Bug Fixes
 | 
			
		||||
 | 
			
		||||
* [#3304](https://github.com/netbox-community/netbox/issues/3304) - Fix caching invalidation issue related to device/virtual machine primary IP addresses
 | 
			
		||||
* [#4647](https://github.com/netbox-community/netbox/issues/4647) - Fix caching invalidation issue related to assinging new IP addresses to interfaces
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -618,7 +618,12 @@ class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModel
 | 
			
		||||
        if self.instance and self.instance.interface:
 | 
			
		||||
            self.fields['interface'].queryset = Interface.objects.filter(
 | 
			
		||||
                device=self.instance.interface.device, virtual_machine=self.instance.interface.virtual_machine
 | 
			
		||||
            )
 | 
			
		||||
            ).prefetch_related(
 | 
			
		||||
                'device__primary_ip4',
 | 
			
		||||
                'device__primary_ip6',
 | 
			
		||||
                'virtual_machine__primary_ip4',
 | 
			
		||||
                'virtual_machine__primary_ip6',
 | 
			
		||||
            )  # We prefetch the primary address fields to ensure cache invalidation does not balk on the save()
 | 
			
		||||
        else:
 | 
			
		||||
            self.fields['interface'].choices = []
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user