mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Fixes #3137: Add power_port and feed_leg fields to power outlet creation form
This commit is contained in:
parent
d4db04c649
commit
25c8007b66
@ -7,7 +7,7 @@ v2.6.0 (FUTURE)
|
|||||||
* [#3126](https://github.com/digitalocean/netbox/issues/3126) - Incorrect calculation of PowerFeed available power
|
* [#3126](https://github.com/digitalocean/netbox/issues/3126) - Incorrect calculation of PowerFeed available power
|
||||||
* [#3130](https://github.com/digitalocean/netbox/issues/3130) - Fix exception when creating a new power outlet
|
* [#3130](https://github.com/digitalocean/netbox/issues/3130) - Fix exception when creating a new power outlet
|
||||||
* [#3136](https://github.com/digitalocean/netbox/issues/3136) - Add power draw fields to power port creation form
|
* [#3136](https://github.com/digitalocean/netbox/issues/3136) - Add power draw fields to power port creation form
|
||||||
|
* [#3137](https://github.com/digitalocean/netbox/issues/3137) - Add `power_port` and `feed_leg` fields to power outlet creation form
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -2026,6 +2026,14 @@ class PowerOutletCreateForm(ComponentForm):
|
|||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
)
|
)
|
||||||
|
power_port = forms.ModelChoiceField(
|
||||||
|
queryset=PowerPort.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
feed_leg = forms.ChoiceField(
|
||||||
|
choices=add_blank_choice(POWERFEED_LEG_CHOICES),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
required=False
|
required=False
|
||||||
@ -2034,6 +2042,13 @@ class PowerOutletCreateForm(ComponentForm):
|
|||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
# Limit power_port choices to those on the parent device
|
||||||
|
self.fields['power_port'].queryset = PowerPort.objects.filter(device=self.parent)
|
||||||
|
|
||||||
|
|
||||||
class PowerOutletBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
class PowerOutletBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
||||||
pk = forms.ModelMultipleChoiceField(
|
pk = forms.ModelMultipleChoiceField(
|
||||||
@ -2041,7 +2056,7 @@ class PowerOutletBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
|||||||
widget=forms.MultipleHiddenInput()
|
widget=forms.MultipleHiddenInput()
|
||||||
)
|
)
|
||||||
feed_leg = forms.ChoiceField(
|
feed_leg = forms.ChoiceField(
|
||||||
choices=POWERFEED_LEG_CHOICES,
|
choices=add_blank_choice(POWERFEED_LEG_CHOICES),
|
||||||
required=False,
|
required=False,
|
||||||
)
|
)
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
|
Loading…
Reference in New Issue
Block a user