|
|
@@ -2098,6 +2098,15 @@ class FrontPortForm(BootstrapMixin, forms.ModelForm):
|
|
|
'device': forms.HiddenInput(),
|
|
|
}
|
|
|
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
+ super().__init__(*args, **kwargs)
|
|
|
+
|
|
|
+ # Limit RearPort choices to the local device
|
|
|
+ if hasattr(self.instance, 'device'):
|
|
|
+ self.fields['rear_port'].queryset = self.fields['rear_port'].queryset.filter(
|
|
|
+ device=self.instance.device
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
# TODO: Merge with FrontPortTemplateCreateForm to remove duplicate logic
|
|
|
class FrontPortCreateForm(ComponentForm):
|