Procházet zdrojové kódy

Fixes #1319: Fixed server error when attempting to create console/power connections

Jeremy Stretch před 8 roky
rodič
revize
b253c8cc95
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      netbox/utilities/forms.py

+ 1 - 1
netbox/utilities/forms.py

@@ -489,7 +489,7 @@ class ChainedFieldsMixin(forms.BaseForm):
 
                 if filters_dict:
                     field.queryset = field.queryset.filter(**filters_dict)
-                elif not self.is_bound and self.instance and hasattr(self.instance, field_name):
+                elif not self.is_bound and getattr(self, 'instance', None) and hasattr(self.instance, field_name):
                     obj = getattr(self.instance, field_name)
                     if obj is not None:
                         field.queryset = field.queryset.filter(pk=obj.pk)