Просмотр исходного кода

Fixes #7849: Fix exception when creating an FHRPGroup with an invalid IP address

jeremystretch 4 лет назад
Родитель
Сommit
6f7fbf7686
2 измененных файлов с 3 добавлено и 2 удалено
  1. 1 0
      docs/release-notes/version-3.1.md
  2. 2 2
      netbox/ipam/forms/models.py

+ 1 - 0
docs/release-notes/version-3.1.md

@@ -13,6 +13,7 @@
 * [#7757](https://github.com/netbox-community/netbox/issues/7757) - Fix 404 when assigning multiple contacts/FHRP groups in succession
 * [#7768](https://github.com/netbox-community/netbox/issues/7768) - Validate IP address status when creating a new FHRP group
 * [#7771](https://github.com/netbox-community/netbox/issues/7771) - Group assignment should be optional when creating contacts via REST API
+* [#7849](https://github.com/netbox-community/netbox/issues/7849) - Fix exception when creating an FHRPGroup with an invalid IP address
 
 ---
 

+ 2 - 2
netbox/ipam/forms/models.py

@@ -587,8 +587,8 @@ class FHRPGroupForm(BootstrapMixin, CustomFieldModelForm):
         return instance
 
     def clean(self):
-        ip_address = self.cleaned_data['ip_address']
-        ip_status = self.cleaned_data['ip_status']
+        ip_address = self.cleaned_data.get('ip_address')
+        ip_status = self.cleaned_data.get('ip_status')
 
         if ip_address and not ip_status:
             raise forms.ValidationError({