mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
10902 add location to power feed form (#10913)
* 10902 add location to power feed form * Bind location field to selected site Co-authored-by: jeremystretch <jstretch@ns1.com>
This commit is contained in:
parent
c6930e3ea8
commit
928d880f0e
@ -877,10 +877,21 @@ class PowerFeedForm(NetBoxModelForm):
|
|||||||
'site_id': '$site'
|
'site_id': '$site'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
location = DynamicModelChoiceField(
|
||||||
|
queryset=Location.objects.all(),
|
||||||
|
required=False,
|
||||||
|
query_params={
|
||||||
|
'site_id': '$site'
|
||||||
|
},
|
||||||
|
initial_params={
|
||||||
|
'racks': '$rack'
|
||||||
|
}
|
||||||
|
)
|
||||||
rack = DynamicModelChoiceField(
|
rack = DynamicModelChoiceField(
|
||||||
queryset=Rack.objects.all(),
|
queryset=Rack.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
query_params={
|
query_params={
|
||||||
|
'location_id': '$location',
|
||||||
'site_id': '$site'
|
'site_id': '$site'
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -888,14 +899,14 @@ class PowerFeedForm(NetBoxModelForm):
|
|||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Power Panel', ('region', 'site', 'power_panel')),
|
('Power Panel', ('region', 'site', 'power_panel')),
|
||||||
('Power Feed', ('rack', 'name', 'status', 'type', 'mark_connected', 'tags')),
|
('Power Feed', ('location', 'rack', 'name', 'status', 'type', 'mark_connected', 'tags')),
|
||||||
('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')),
|
('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')),
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PowerFeed
|
model = PowerFeed
|
||||||
fields = [
|
fields = [
|
||||||
'region', 'site_group', 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply',
|
'region', 'site_group', 'site', 'power_panel', 'location', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply',
|
||||||
'phase', 'voltage', 'amperage', 'max_utilization', 'comments', 'tags',
|
'phase', 'voltage', 'amperage', 'max_utilization', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
|
Loading…
Reference in New Issue
Block a user