mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add region field to device form
This commit is contained in:
@ -1670,8 +1670,15 @@ class PlatformCSVForm(CSVModelForm):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||||
|
region = DynamicModelChoiceField(
|
||||||
|
queryset=Region.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
site = DynamicModelChoiceField(
|
site = DynamicModelChoiceField(
|
||||||
queryset=Site.objects.all()
|
queryset=Site.objects.all(),
|
||||||
|
query_params={
|
||||||
|
'region_id': '$region'
|
||||||
|
}
|
||||||
)
|
)
|
||||||
rack = DynamicModelChoiceField(
|
rack = DynamicModelChoiceField(
|
||||||
queryset=Rack.objects.all(),
|
queryset=Rack.objects.all(),
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading"><strong>Location</strong></div>
|
<div class="panel-heading"><strong>Location</strong></div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
{% render_field form.region %}
|
||||||
{% render_field form.site %}
|
{% render_field form.site %}
|
||||||
{% render_field form.rack %}
|
{% render_field form.rack %}
|
||||||
{% if obj.device_type.is_child_device and obj.parent_bay %}
|
{% if obj.device_type.is_child_device and obj.parent_bay %}
|
||||||
|
Reference in New Issue
Block a user