diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 723b32513c6..bb42b731508 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -489,7 +489,7 @@ def __init__(self, *args, **kwargs): 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)