From 56e36e34310a04749fcb91c429e58c304b9718d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Kr=C3=B6ger?= Date: Tue, 9 Sep 2025 15:42:35 +0200 Subject: [PATCH] Fix access to None members for ServertypeAttributeAdminForm --- serveradmin/serverdb/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/serveradmin/serverdb/forms.py b/serveradmin/serverdb/forms.py index e66264b2..31fc78e8 100644 --- a/serveradmin/serverdb/forms.py +++ b/serveradmin/serverdb/forms.py @@ -22,10 +22,11 @@ class Meta: def clean(self): # It makes no sense to add inet or supernet attributes to hosts of - # ip_addr_type null because they would have to be empty anyways. + # ip_addr_type null because they would have to be empty anyway. inet_attribute = ( + 'attribute' in self.cleaned_data and self.cleaned_data['attribute'].type in ('inet', 'supernet') and - self.instance.servertype.ip_addr_type == 'null' + self.cleaned_data['servertype'].ip_addr_type == 'null' ) if inet_attribute: raise ValidationError(