mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Fixes #3130: Fix exception when creating a new power outlet
This commit is contained in:
@ -2006,9 +2006,10 @@ class PowerOutletForm(BootstrapMixin, forms.ModelForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
# Limit power_port choices to the local device
|
||||
self.fields['power_port'].queryset = PowerPort.objects.filter(
|
||||
device=self.instance.device
|
||||
)
|
||||
if hasattr(self.instance, 'device'):
|
||||
self.fields['power_port'].queryset = PowerPort.objects.filter(
|
||||
device=self.instance.device
|
||||
)
|
||||
|
||||
|
||||
class PowerOutletCreateForm(ComponentForm):
|
||||
|
Reference in New Issue
Block a user