|
|
@@ -352,8 +352,18 @@ class SiteFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldFilterForm):
|
|
|
#
|
|
|
|
|
|
class RackGroupForm(BootstrapMixin, forms.ModelForm):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
- queryset=Site.objects.all()
|
|
|
+ queryset=Site.objects.all(),
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
parent = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -367,7 +377,7 @@ class RackGroupForm(BootstrapMixin, forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = RackGroup
|
|
|
fields = (
|
|
|
- 'site', 'parent', 'name', 'slug', 'description',
|
|
|
+ 'region', 'site', 'parent', 'name', 'slug', 'description',
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -447,14 +457,17 @@ class RackRoleCSVForm(CSVModelForm):
|
|
|
#
|
|
|
|
|
|
class RackForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
|
|
- site = DynamicModelChoiceField(
|
|
|
- queryset=Site.objects.all()
|
|
|
- )
|
|
|
- group = DynamicModelChoiceField(
|
|
|
- queryset=RackGroup.objects.all(),
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
+ site = DynamicModelChoiceField(
|
|
|
+ queryset=Site.objects.all(),
|
|
|
query_params={
|
|
|
- 'site_id': '$site'
|
|
|
+ 'region_id': '$region'
|
|
|
}
|
|
|
)
|
|
|
role = DynamicModelChoiceField(
|
|
|
@@ -470,8 +483,9 @@ class RackForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
|
|
class Meta:
|
|
|
model = Rack
|
|
|
fields = [
|
|
|
- 'site', 'group', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial', 'asset_tag',
|
|
|
- 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'comments', 'tags',
|
|
|
+ 'region', 'site', 'group', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial',
|
|
|
+ 'asset_tag', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
|
|
|
+ 'comments', 'tags',
|
|
|
]
|
|
|
help_texts = {
|
|
|
'site': "The site at which the rack exists",
|
|
|
@@ -548,9 +562,19 @@ class RackBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditFor
|
|
|
queryset=Rack.objects.all(),
|
|
|
widget=forms.MultipleHiddenInput
|
|
|
)
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
group = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -691,9 +715,19 @@ class RackElevationFilterForm(RackFilterForm):
|
|
|
#
|
|
|
|
|
|
class RackReservationForm(BootstrapMixin, TenancyForm, forms.ModelForm):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
rack_group = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -707,7 +741,7 @@ class RackReservationForm(BootstrapMixin, TenancyForm, forms.ModelForm):
|
|
|
display_field='display_name',
|
|
|
query_params={
|
|
|
'site_id': '$site',
|
|
|
- 'group_id': 'rack',
|
|
|
+ 'group_id': '$rack',
|
|
|
}
|
|
|
)
|
|
|
units = NumericArrayField(
|
|
|
@@ -809,15 +843,23 @@ class RackReservationBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditFor
|
|
|
|
|
|
class RackReservationFilterForm(BootstrapMixin, TenancyFilterForm):
|
|
|
model = RackReservation
|
|
|
- field_order = ['q', 'site', 'group_id', 'tenant_group', 'tenant']
|
|
|
+ field_order = ['q', 'region', 'site', 'group_id', 'tenant_group', 'tenant']
|
|
|
q = forms.CharField(
|
|
|
required=False,
|
|
|
label='Search'
|
|
|
)
|
|
|
+ region = DynamicModelMultipleChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ to_field_name='slug',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
site = DynamicModelMultipleChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
to_field_name='slug',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
group_id = DynamicModelMultipleChoiceField(
|
|
|
queryset=RackGroup.objects.prefetch_related('site'),
|
|
|
@@ -3417,10 +3459,18 @@ class ConnectCableToDeviceForm(BootstrapMixin, forms.ModelForm):
|
|
|
"""
|
|
|
Base form for connecting a Cable to a Device component
|
|
|
"""
|
|
|
+ termination_b_region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ label='Region',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
termination_b_site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
label='Site',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$termination_b_region'
|
|
|
+ }
|
|
|
)
|
|
|
termination_b_rack = DynamicModelChoiceField(
|
|
|
queryset=Rack.objects.all(),
|
|
|
@@ -3446,8 +3496,8 @@ class ConnectCableToDeviceForm(BootstrapMixin, forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = Cable
|
|
|
fields = [
|
|
|
- 'termination_b_site', 'termination_b_rack', 'termination_b_device', 'termination_b_id', 'type', 'status',
|
|
|
- 'label', 'color', 'length', 'length_unit',
|
|
|
+ 'termination_b_region', 'termination_b_site', 'termination_b_rack', 'termination_b_device',
|
|
|
+ 'termination_b_id', 'type', 'status', 'label', 'color', 'length', 'length_unit',
|
|
|
]
|
|
|
widgets = {
|
|
|
'status': StaticSelect2,
|
|
|
@@ -3544,10 +3594,18 @@ class ConnectCableToCircuitTerminationForm(BootstrapMixin, forms.ModelForm):
|
|
|
label='Provider',
|
|
|
required=False
|
|
|
)
|
|
|
+ termination_b_region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ label='Region',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
termination_b_site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
label='Site',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$termination_b_region'
|
|
|
+ }
|
|
|
)
|
|
|
termination_b_circuit = DynamicModelChoiceField(
|
|
|
queryset=Circuit.objects.all(),
|
|
|
@@ -3571,8 +3629,8 @@ class ConnectCableToCircuitTerminationForm(BootstrapMixin, forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = Cable
|
|
|
fields = [
|
|
|
- 'termination_b_provider', 'termination_b_site', 'termination_b_circuit', 'termination_b_id', 'type',
|
|
|
- 'status', 'label', 'color', 'length', 'length_unit',
|
|
|
+ 'termination_b_provider', 'termination_b_region', 'termination_b_site', 'termination_b_circuit',
|
|
|
+ 'termination_b_id', 'type', 'status', 'label', 'color', 'length', 'length_unit',
|
|
|
]
|
|
|
|
|
|
def clean_termination_b_id(self):
|
|
|
@@ -3581,11 +3639,18 @@ class ConnectCableToCircuitTerminationForm(BootstrapMixin, forms.ModelForm):
|
|
|
|
|
|
|
|
|
class ConnectCableToPowerFeedForm(BootstrapMixin, forms.ModelForm):
|
|
|
+ termination_b_region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ label='Region',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
termination_b_site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
label='Site',
|
|
|
required=False,
|
|
|
- display_field='cid'
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$termination_b_region'
|
|
|
+ }
|
|
|
)
|
|
|
termination_b_rackgroup = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -3827,10 +3892,18 @@ class CableFilterForm(BootstrapMixin, forms.Form):
|
|
|
required=False,
|
|
|
label='Search'
|
|
|
)
|
|
|
+ region = DynamicModelMultipleChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ to_field_name='slug',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
site = DynamicModelMultipleChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
to_field_name='slug',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
tenant = DynamicModelMultipleChoiceField(
|
|
|
queryset=Tenant.objects.all(),
|
|
|
@@ -3879,10 +3952,18 @@ class CableFilterForm(BootstrapMixin, forms.Form):
|
|
|
#
|
|
|
|
|
|
class ConsoleConnectionFilterForm(BootstrapMixin, forms.Form):
|
|
|
+ region = DynamicModelMultipleChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ to_field_name='slug',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
site = DynamicModelMultipleChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
to_field_name='slug',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
device_id = DynamicModelMultipleChoiceField(
|
|
|
queryset=Device.objects.all(),
|
|
|
@@ -3895,10 +3976,18 @@ class ConsoleConnectionFilterForm(BootstrapMixin, forms.Form):
|
|
|
|
|
|
|
|
|
class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
|
|
|
+ region = DynamicModelMultipleChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ to_field_name='slug',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
site = DynamicModelMultipleChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
to_field_name='slug',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
device_id = DynamicModelMultipleChoiceField(
|
|
|
queryset=Device.objects.all(),
|
|
|
@@ -3911,10 +4000,18 @@ class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
|
|
|
|
|
|
|
|
|
class InterfaceConnectionFilterForm(BootstrapMixin, forms.Form):
|
|
|
+ region = DynamicModelMultipleChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ to_field_name='slug',
|
|
|
+ required=False
|
|
|
+ )
|
|
|
site = DynamicModelMultipleChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
to_field_name='slug',
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
device_id = DynamicModelMultipleChoiceField(
|
|
|
queryset=Device.objects.all(),
|
|
|
@@ -3938,9 +4035,19 @@ class DeviceSelectionForm(forms.Form):
|
|
|
|
|
|
|
|
|
class VirtualChassisCreateForm(BootstrapMixin, forms.ModelForm):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
rack = DynamicModelChoiceField(
|
|
|
queryset=Rack.objects.all(),
|
|
|
@@ -3973,7 +4080,7 @@ class VirtualChassisCreateForm(BootstrapMixin, forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = VirtualChassis
|
|
|
fields = [
|
|
|
- 'name', 'domain', 'site', 'rack', 'members', 'initial_position', 'tags',
|
|
|
+ 'name', 'domain', 'region', 'site', 'rack', 'members', 'initial_position', 'tags',
|
|
|
]
|
|
|
|
|
|
def save(self, *args, **kwargs):
|
|
|
@@ -4070,9 +4177,19 @@ class DeviceVCMembershipForm(forms.ModelForm):
|
|
|
|
|
|
|
|
|
class VCMemberSelectForm(BootstrapMixin, forms.Form):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
rack = DynamicModelChoiceField(
|
|
|
queryset=Rack.objects.all(),
|
|
|
@@ -4171,8 +4288,18 @@ class VirtualChassisFilterForm(BootstrapMixin, CustomFieldFilterForm):
|
|
|
#
|
|
|
|
|
|
class PowerPanelForm(BootstrapMixin, forms.ModelForm):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
- queryset=Site.objects.all()
|
|
|
+ queryset=Site.objects.all(),
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
rack_group = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -4189,7 +4316,7 @@ class PowerPanelForm(BootstrapMixin, forms.ModelForm):
|
|
|
class Meta:
|
|
|
model = PowerPanel
|
|
|
fields = [
|
|
|
- 'site', 'rack_group', 'name', 'tags',
|
|
|
+ 'region', 'site', 'rack_group', 'name', 'tags',
|
|
|
]
|
|
|
|
|
|
|
|
|
@@ -4224,9 +4351,19 @@ class PowerPanelBulkEditForm(BootstrapMixin, AddRemoveTagsForm, BulkEditForm):
|
|
|
queryset=PowerPanel.objects.all(),
|
|
|
widget=forms.MultipleHiddenInput
|
|
|
)
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites': '$site'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
- required=False
|
|
|
+ required=False,
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
+ }
|
|
|
)
|
|
|
rack_group = DynamicModelChoiceField(
|
|
|
queryset=RackGroup.objects.all(),
|
|
|
@@ -4278,11 +4415,21 @@ class PowerPanelFilterForm(BootstrapMixin, CustomFieldFilterForm):
|
|
|
#
|
|
|
|
|
|
class PowerFeedForm(BootstrapMixin, CustomFieldModelForm):
|
|
|
+ region = DynamicModelChoiceField(
|
|
|
+ queryset=Region.objects.all(),
|
|
|
+ required=False,
|
|
|
+ initial_params={
|
|
|
+ 'sites__powerpanel': '$power_panel'
|
|
|
+ }
|
|
|
+ )
|
|
|
site = DynamicModelChoiceField(
|
|
|
queryset=Site.objects.all(),
|
|
|
required=False,
|
|
|
initial_params={
|
|
|
'powerpanel': '$power_panel'
|
|
|
+ },
|
|
|
+ query_params={
|
|
|
+ 'region_id': '$region'
|
|
|
}
|
|
|
)
|
|
|
power_panel = DynamicModelChoiceField(
|
|
|
@@ -4308,7 +4455,7 @@ class PowerFeedForm(BootstrapMixin, CustomFieldModelForm):
|
|
|
class Meta:
|
|
|
model = PowerFeed
|
|
|
fields = [
|
|
|
- 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage',
|
|
|
+ 'region', 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage',
|
|
|
'max_utilization', 'comments', 'tags',
|
|
|
]
|
|
|
widgets = {
|