1
0
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:
Jeremy Stretch
2020-08-13 10:45:01 -04:00
parent 0e91d837a0
commit e252de319e
2 changed files with 9 additions and 1 deletions

View File

@ -1670,8 +1670,15 @@ class PlatformCSVForm(CSVModelForm):
#
class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
region = DynamicModelChoiceField(
queryset=Region.objects.all(),
required=False
)
site = DynamicModelChoiceField(
queryset=Site.objects.all()
queryset=Site.objects.all(),
query_params={
'region_id': '$region'
}
)
rack = DynamicModelChoiceField(
queryset=Rack.objects.all(),

View File

@ -21,6 +21,7 @@
<div class="panel panel-default">
<div class="panel-heading"><strong>Location</strong></div>
<div class="panel-body">
{% render_field form.region %}
{% render_field form.site %}
{% render_field form.rack %}
{% if obj.device_type.is_child_device and obj.parent_bay %}