class RackBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Rack.objects.all(), widget=forms.MultipleHiddenInput) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False, initial_params={'sites': '$site'}) site_group = DynamicModelChoiceField(queryset=SiteGroup.objects.all(), required=False, initial_params={'sites': '$site'}) site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, query_params={ 'region_id': '$region', 'group_id': '$site_group', }) location = DynamicModelChoiceField(queryset=Location.objects.all(), required=False, query_params={'site_id': '$site'}) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) status = forms.ChoiceField(choices=add_blank_choice(RackStatusChoices), required=False, initial='', widget=StaticSelect()) role = DynamicModelChoiceField(queryset=RackRole.objects.all(), required=False) serial = forms.CharField(max_length=50, required=False, label='Serial Number') asset_tag = forms.CharField(max_length=50, required=False) type = forms.ChoiceField(choices=add_blank_choice(RackTypeChoices), required=False, widget=StaticSelect()) width = forms.ChoiceField(choices=add_blank_choice(RackWidthChoices), required=False, widget=StaticSelect()) u_height = forms.IntegerField(required=False, label='Height (U)') desc_units = forms.NullBooleanField(required=False, widget=BulkEditNullBooleanSelect, label='Descending units') outer_width = forms.IntegerField(required=False, min_value=1) outer_depth = forms.IntegerField(required=False, min_value=1) outer_unit = forms.ChoiceField( choices=add_blank_choice(RackDimensionUnitChoices), required=False, widget=StaticSelect()) comments = CommentField(widget=SmallTextarea, label='Comments') class Meta: nullable_fields = [ 'location', 'tenant', 'role', 'serial', 'asset_tag', 'outer_width', 'outer_depth', 'outer_unit', 'comments', ]
class IPAddressBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=IPAddress.objects.all(), widget=forms.MultipleHiddenInput()) vrf = DynamicModelChoiceField(queryset=VRF.objects.all(), required=False, label='VRF') mask_length = forms.IntegerField(min_value=IPADDRESS_MASK_LENGTH_MIN, max_value=IPADDRESS_MASK_LENGTH_MAX, required=False) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) status = forms.ChoiceField( choices=add_blank_choice(IPAddressStatusChoices), required=False, widget=StaticSelect()) role = forms.ChoiceField(choices=add_blank_choice(IPAddressRoleChoices), required=False, widget=StaticSelect()) dns_name = forms.CharField(max_length=255, required=False, label='DNS name') description = forms.CharField(max_length=100, required=False) class Meta: nullable_fields = [ 'vrf', 'role', 'tenant', 'dns_name', 'description', ]
class Meta: model = Device fields = [ 'name', 'device_role', 'device_type', 'serial', 'asset_tag', 'region', 'site_group', 'site', 'rack', 'location', 'position', 'face', 'status', 'airflow', 'platform', 'primary_ip4', 'primary_ip6', 'cluster_group', 'cluster', 'tenant_group', 'tenant', 'comments', 'tags', 'local_context_data' ] help_texts = { 'device_role': "The function this device serves", 'serial': "Chassis serial number", 'local_context_data': "Local config context data overwrites all source contexts in the final rendered " "config context", } widgets = { 'face': StaticSelect(), 'status': StaticSelect(), 'airflow': StaticSelect(), 'primary_ip4': StaticSelect(), 'primary_ip6': StaticSelect(), }
class Meta: model = IPAddress fields = [ 'address', 'vrf', 'status', 'role', 'dns_name', 'description', 'primary_for_parent', 'nat_site', 'nat_rack', 'nat_device', 'nat_cluster', 'nat_virtual_machine', 'nat_vrf', 'nat_inside', 'tenant_group', 'tenant', 'tags', ] widgets = { 'status': StaticSelect(), 'role': StaticSelect(), }
class Meta: model = PowerFeed fields = [ 'region', 'site_group', 'site', 'power_panel', 'rack', 'name', 'status', 'type', 'mark_connected', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization', 'comments', 'tags', ] fieldsets = ( ('Power Panel', ('region', 'site', 'power_panel')), ('Power Feed', ('rack', 'name', 'status', 'type', 'mark_connected', 'tags')), ('Characteristics', ('supply', 'voltage', 'amperage', 'phase', 'max_utilization')), ) widgets = { 'status': StaticSelect(), 'type': StaticSelect(), 'supply': StaticSelect(), 'phase': StaticSelect(), }
class Meta: model = Interface fields = [ 'device', 'name', 'label', 'type', 'enabled', 'parent', 'lag', 'mac_address', 'mtu', 'mgmt_only', 'mark_connected', 'description', 'mode', 'untagged_vlan', 'tagged_vlans', 'tags', ] widgets = { 'device': forms.HiddenInput(), 'type': StaticSelect(), 'mode': StaticSelect(), } labels = { 'mode': '802.1Q Mode', } help_texts = { 'mode': INTERFACE_MODE_HELP_TEXT, }
class WebhookFilterForm(BootstrapMixin, forms.Form): field_groups = [ ['q'], ['content_types', 'http_method', 'enabled'], ['type_create', 'type_update', 'type_delete'], ] q = forms.CharField( required=False, widget=forms.TextInput(attrs={'placeholder': _('All Fields')}), label=_('Search')) content_types = ContentTypeMultipleChoiceField( queryset=ContentType.objects.all(), limit_choices_to=FeatureQuery('custom_fields'), required=False) http_method = forms.MultipleChoiceField(choices=WebhookHttpMethodChoices, required=False, widget=StaticSelectMultiple(), label=_('HTTP method')) enabled = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_create = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_update = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_delete = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
class SiteBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Site.objects.all(), widget=forms.MultipleHiddenInput) status = forms.ChoiceField(choices=add_blank_choice(SiteStatusChoices), required=False, initial='', widget=StaticSelect()) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False) group = DynamicModelChoiceField(queryset=SiteGroup.objects.all(), required=False) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) asn = forms.IntegerField(min_value=BGP_ASN_MIN, max_value=BGP_ASN_MAX, required=False, label='ASN') description = forms.CharField(max_length=100, required=False) time_zone = TimeZoneFormField(choices=add_blank_choice( TimeZoneFormField().choices), required=False, widget=StaticSelect()) class Meta: nullable_fields = [ 'region', 'group', 'tenant', 'asn', 'description', 'time_zone', ]
class WebhookFilterForm(FilterForm): field_groups = [ ['q'], ['content_types', 'http_method', 'enabled'], ['type_create', 'type_update', 'type_delete'], ] content_types = ContentTypeMultipleChoiceField( queryset=ContentType.objects.all(), limit_choices_to=FeatureQuery('webhooks'), required=False) http_method = forms.MultipleChoiceField(choices=WebhookHttpMethodChoices, required=False, widget=StaticSelectMultiple(), label=_('HTTP method')) enabled = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_create = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_update = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) type_delete = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
class Meta: model = IPAddress fields = [ 'address', 'vrf', 'status', 'role', 'dns_name', 'description', 'tenant_group', 'tenant', 'tags', ] widgets = { 'status': StaticSelect(), 'role': StaticSelect(), }
class PowerFeedFilterForm(CustomFieldModelFilterForm): model = PowerFeed field_groups = [ ['q', 'tag'], ['region_id', 'site_group_id', 'site_id'], ['power_panel_id', 'rack_id'], [ 'status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization' ], ] region_id = DynamicModelMultipleChoiceField(queryset=Region.objects.all(), required=False, label='Region') site_group_id = DynamicModelMultipleChoiceField( queryset=SiteGroup.objects.all(), required=False, label='Site group') site_id = DynamicModelMultipleChoiceField( queryset=Site.objects.all(), required=False, query_params={'region_id': '$region_id'}, label='Site') power_panel_id = DynamicModelMultipleChoiceField( queryset=PowerPanel.objects.all(), required=False, null_option='None', query_params={'site_id': '$site_id'}, label='Power panel') rack_id = DynamicModelMultipleChoiceField( queryset=Rack.objects.all(), required=False, null_option='None', query_params={'site_id': '$site_id'}, label='Rack') status = forms.MultipleChoiceField(label='Статус', choices=PowerFeedStatusChoices, required=False, widget=StaticSelectMultiple()) type = forms.ChoiceField(label='Тип', choices=add_blank_choice(PowerFeedTypeChoices), required=False, widget=StaticSelect()) supply = forms.ChoiceField( label='Поставка', choices=add_blank_choice(PowerFeedSupplyChoices), required=False, widget=StaticSelect()) phase = forms.ChoiceField(label='Фаза', choices=add_blank_choice(PowerFeedPhaseChoices), required=False, widget=StaticSelect()) voltage = forms.IntegerField(label='Напряжение', required=False) amperage = forms.IntegerField(label='Ток', required=False) max_utilization = forms.IntegerField(label='max_utilization', required=False) tag = TagFilterField(model)
class ConsoleServerPortCreateForm(ComponentCreateForm): model = ConsoleServerPort type = forms.ChoiceField(choices=add_blank_choice(ConsolePortTypeChoices), required=False, widget=StaticSelect()) speed = forms.ChoiceField( choices=add_blank_choice(ConsolePortSpeedChoices), required=False, widget=StaticSelect()) field_order = ('device', 'name_pattern', 'label_pattern', 'type', 'speed', 'mark_connected', 'description', 'tags')
class CableFilterForm(BootstrapMixin, CustomFieldModelFilterForm): model = Cable field_groups = [ ['q', 'tag'], ['site_id', 'rack_id', 'device_id'], ['type', 'status', 'color'], ['tenant_id'], ] q = forms.CharField( required=False, widget=forms.TextInput(attrs={'placeholder': _('All Fields')}), label=_('Search')) region_id = DynamicModelMultipleChoiceField(queryset=Region.objects.all(), required=False, label=_('Region'), fetch_trigger='open') site_id = DynamicModelMultipleChoiceField( queryset=Site.objects.all(), required=False, query_params={'region_id': '$region_id'}, label=_('Site'), fetch_trigger='open') tenant_id = DynamicModelMultipleChoiceField(queryset=Tenant.objects.all(), required=False, label=_('Tenant'), fetch_trigger='open') rack_id = DynamicModelMultipleChoiceField( queryset=Rack.objects.all(), required=False, label=_('Rack'), null_option='None', query_params={'site_id': '$site_id'}, fetch_trigger='open') type = forms.MultipleChoiceField( choices=add_blank_choice(CableTypeChoices), required=False, widget=StaticSelect()) status = forms.ChoiceField(required=False, choices=add_blank_choice(CableStatusChoices), widget=StaticSelect()) color = ColorField(required=False) device_id = DynamicModelMultipleChoiceField(queryset=Device.objects.all(), required=False, query_params={ 'site_id': '$site_id', 'tenant_id': '$tenant_id', 'rack_id': '$rack_id', }, label=_('Device'), fetch_trigger='open') tag = TagFilterField(model)
class InterfaceFilterForm(DeviceComponentFilterForm): model = Interface field_groups = [ ['q', 'tag'], [ 'name', 'label', 'kind', 'type', 'enabled', 'mgmt_only', 'mac_address', 'wwn' ], ['rf_role', 'rf_channel', 'rf_channel_width', 'tx_power'], [ 'region_id', 'site_group_id', 'site_id', 'location_id', 'virtual_chassis_id', 'device_id' ], ] kind = forms.MultipleChoiceField(label='kind', choices=InterfaceKindChoices, required=False, widget=StaticSelectMultiple()) type = forms.MultipleChoiceField(label='Тип', choices=InterfaceTypeChoices, required=False, widget=StaticSelectMultiple()) enabled = forms.NullBooleanField( label='Включен', required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) mgmt_only = forms.NullBooleanField( label='mgmt_only', required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) mac_address = forms.CharField(required=False, label='MAC address') wwn = forms.CharField(required=False, label='WWN') rf_role = forms.MultipleChoiceField(choices=WirelessRoleChoices, required=False, widget=StaticSelectMultiple(), label='Wireless role') rf_channel = forms.MultipleChoiceField(choices=WirelessChannelChoices, required=False, widget=StaticSelectMultiple(), label='Wireless channel') rf_channel_frequency = forms.IntegerField(required=False, label='Channel frequency (MHz)') rf_channel_width = forms.IntegerField(required=False, label='Channel width (MHz)') tx_power = forms.IntegerField(required=False, label='Transmit power (dBm)', min_value=0, max_value=127) tag = TagFilterField(model)
class VLANBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=VLAN.objects.all(), widget=forms.MultipleHiddenInput()) region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False) site_group = DynamicModelChoiceField(queryset=SiteGroup.objects.all(), required=False) site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, query_params={ 'region_id': '$region', 'group_id': '$site_group', }) group = DynamicModelChoiceField(queryset=VLANGroup.objects.all(), required=False, query_params={'site_id': '$site'}) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) status = forms.ChoiceField(choices=add_blank_choice(VLANStatusChoices), required=False, widget=StaticSelect()) role = DynamicModelChoiceField(queryset=Role.objects.all(), required=False) description = forms.CharField(max_length=100, required=False) class Meta: nullable_fields = [ 'site', 'group', 'tenant', 'role', 'description', ]
class IPRangeBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField( queryset=IPRange.objects.all(), widget=forms.MultipleHiddenInput() ) vrf = DynamicModelChoiceField( queryset=VRF.objects.all(), required=False, label='VRF' ) tenant = DynamicModelChoiceField( queryset=Tenant.objects.all(), required=False ) status = forms.ChoiceField( choices=add_blank_choice(IPRangeStatusChoices), required=False, widget=StaticSelect() ) role = DynamicModelChoiceField( queryset=Role.objects.all(), required=False ) description = forms.CharField( max_length=100, required=False ) class Meta: nullable_fields = [ 'vrf', 'tenant', 'role', 'description', ]
class ASNBulkEditForm(NetBoxModelBulkEditForm): pk = forms.ModelMultipleChoiceField( queryset=ASN.objects.all(), widget=forms.MultipleHiddenInput ) tenant = DynamicModelChoiceField( queryset=Tenant.objects.all(), required=False ) description = forms.CharField( max_length=200, required=False ) status = forms.ChoiceField( required=False, choices=ASNStatusChoices, widget=StaticSelect() ) model = ASN fieldsets = ( (None, ('tenant', 'description', 'status')), ) nullable_fields = ( 'tenant', 'description', )
class Meta: model = CustomField fields = '__all__' fieldsets = ( ('Custom Field', ('name', 'label', 'type', 'weight', 'required', 'description')), ('Assigned Models', ('content_types', )), ('Behavior', ('filter_logic', )), ('Values', ('default', 'choices')), ('Validation', ('validation_minimum', 'validation_maximum', 'validation_regex')), ) widgets = { 'type': StaticSelect(), 'filter_logic': StaticSelect(), }
class Meta: model = Webhook fields = '__all__' fieldsets = ( ('Webhook', ('name', 'content_types', 'enabled')), ('Events', ('type_create', 'type_update', 'type_delete')), ('HTTP Request', ( 'payload_url', 'http_method', 'http_content_type', 'additional_headers', 'body_template', 'secret', )), ('Conditions', ('conditions', )), ('SSL', ('ssl_verification', 'ca_file_path')), ) labels = { 'type_create': 'Creations', 'type_update': 'Updates', 'type_delete': 'Deletions', } widgets = { 'http_method': StaticSelect(), 'additional_headers': forms.Textarea(attrs={'class': 'font-monospace'}), 'body_template': forms.Textarea(attrs={'class': 'font-monospace'}), }
class Meta: model = VMInterface fields = [ 'virtual_machine', 'name', 'enabled', 'parent', 'mac_address', 'mtu', 'description', 'mode', 'tags', 'untagged_vlan', 'tagged_vlans', ] widgets = { 'virtual_machine': forms.HiddenInput(), 'mode': StaticSelect() } labels = { 'mode': '802.1Q Mode', } help_texts = { 'mode': INTERFACE_MODE_HELP_TEXT, }
class Meta: model = Circuit fields = [ 'cid', 'type', 'provider', 'status', 'install_date', 'commit_rate', 'description', 'tenant_group', 'tenant', 'comments', 'tags', ] fieldsets = ( ('Circuit', ('provider', 'cid', 'type', 'status', 'install_date', 'commit_rate', 'description', 'tags')), ('Tenancy', ('tenant_group', 'tenant')), ) help_texts = { 'cid': "Unique circuit ID", 'commit_rate': "Committed rate", } widgets = { 'status': StaticSelect(), 'install_date': DatePicker(), 'commit_rate': SelectSpeedWidget(), }
class PowerOutletCreateForm(ComponentCreateForm): model = PowerOutlet type = forms.ChoiceField(choices=add_blank_choice(PowerOutletTypeChoices), required=False, widget=StaticSelect()) power_port = forms.ModelChoiceField(queryset=PowerPort.objects.all(), required=False) feed_leg = forms.ChoiceField( choices=add_blank_choice(PowerOutletFeedLegChoices), required=False) field_order = ( 'device', 'name_pattern', 'label_pattern', 'type', 'power_port', 'feed_leg', 'mark_connected', 'description', 'tags', ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Limit power_port queryset to PowerPorts which belong to the parent Device device = Device.objects.get( pk=self.initial.get('device') or self.data.get('device')) self.fields['power_port'].queryset = PowerPort.objects.filter( device=device)
class PowerOutletTemplateCreateForm(ComponentTemplateCreateForm): type = forms.ChoiceField(choices=add_blank_choice(PowerOutletTypeChoices), required=False) power_port = forms.ModelChoiceField( queryset=PowerPortTemplate.objects.all(), required=False) feed_leg = forms.ChoiceField( choices=add_blank_choice(PowerOutletFeedLegChoices), required=False, widget=StaticSelect()) field_order = ( 'manufacturer', 'device_type', 'name_pattern', 'label_pattern', 'type', 'power_port', 'feed_leg', 'description', ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Limit power_port choices to current DeviceType device_type = DeviceType.objects.get( pk=self.initial.get('device_type') or self.data.get('device_type')) self.fields['power_port'].queryset = PowerPortTemplate.objects.filter( device_type=device_type)
class ObjectChangeFilterForm(FilterForm): model = ObjectChange field_groups = [ ['q'], ['time_before', 'time_after', 'action'], ['user_id', 'changed_object_type_id'], ] time_after = forms.DateTimeField(required=False, label=_('After'), widget=DateTimePicker()) time_before = forms.DateTimeField(required=False, label=_('Before'), widget=DateTimePicker()) action = forms.ChoiceField( choices=add_blank_choice(ObjectChangeActionChoices), required=False, widget=StaticSelect()) user_id = DynamicModelMultipleChoiceField( queryset=User.objects.all(), required=False, label=_('User'), widget=APISelectMultiple(api_url='/api/users/users/', )) changed_object_type_id = DynamicModelMultipleChoiceField( queryset=ContentType.objects.all(), required=False, label=_('Object Type'), widget=APISelectMultiple(api_url='/api/extras/content-types/', ))
class VMInterfaceFilterForm(BootstrapMixin, forms.Form): model = VMInterface field_groups = [ ['q', 'tag'], ['cluster_id', 'virtual_machine_id'], ['enabled', 'mac_address'], ] q = forms.CharField( required=False, widget=forms.TextInput(attrs={'placeholder': _('All Fields')}), label=_('Search')) cluster_id = DynamicModelMultipleChoiceField( queryset=Cluster.objects.all(), required=False, label=_('Cluster'), fetch_trigger='open') virtual_machine_id = DynamicModelMultipleChoiceField( queryset=VirtualMachine.objects.all(), required=False, query_params={'cluster_id': '$cluster_id'}, label=_('Virtual machine'), fetch_trigger='open') enabled = forms.NullBooleanField( required=False, widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES)) mac_address = forms.CharField(required=False, label='MAC address') tag = TagFilterField(model)
class DeviceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Device.objects.all(), widget=forms.MultipleHiddenInput()) manufacturer = DynamicModelChoiceField(queryset=Manufacturer.objects.all(), required=False) device_type = DynamicModelChoiceField( queryset=DeviceType.objects.all(), required=False, query_params={'manufacturer_id': '$manufacturer'}) device_role = DynamicModelChoiceField(queryset=DeviceRole.objects.all(), required=False) site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False) location = DynamicModelChoiceField(queryset=Location.objects.all(), required=False, query_params={'site_id': '$site'}) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) platform = DynamicModelChoiceField(queryset=Platform.objects.all(), required=False) status = forms.ChoiceField(choices=add_blank_choice(DeviceStatusChoices), required=False, widget=StaticSelect()) serial = forms.CharField(max_length=50, required=False, label='Serial Number') class Meta: nullable_fields = [ 'tenant', 'platform', 'serial', ]
class IPRangeFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldModelFilterForm): model = IPRange field_groups = [ ['q', 'tag'], ['family', 'vrf_id', 'status', 'role_id'], ['tenant_group_id', 'tenant_id'], ] q = forms.CharField( required=False, widget=forms.TextInput(attrs={'placeholder': _('All Fields')}), label=_('Search')) family = forms.ChoiceField( required=False, choices=add_blank_choice(IPAddressFamilyChoices), label=_('Address family'), widget=StaticSelect()) vrf_id = DynamicModelMultipleChoiceField(queryset=VRF.objects.all(), required=False, label=_('Assigned VRF'), null_option='Global', fetch_trigger='open') status = forms.MultipleChoiceField(choices=PrefixStatusChoices, required=False, widget=StaticSelectMultiple()) role_id = DynamicModelMultipleChoiceField(queryset=Role.objects.all(), required=False, null_option='None', label=_('Role'), fetch_trigger='open') tag = TagFilterField(model)
class ServiceBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField( queryset=Service.objects.all(), widget=forms.MultipleHiddenInput() ) protocol = forms.ChoiceField( choices=add_blank_choice(ServiceProtocolChoices), required=False, widget=StaticSelect() ) ports = NumericArrayField( base_field=forms.IntegerField( min_value=SERVICE_PORT_MIN, max_value=SERVICE_PORT_MAX ), required=False ) description = forms.CharField( max_length=100, required=False ) class Meta: nullable_fields = [ 'description', ]
class CircuitBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=Circuit.objects.all(), widget=forms.MultipleHiddenInput) type = DynamicModelChoiceField(queryset=CircuitType.objects.all(), required=False) provider = DynamicModelChoiceField(queryset=Provider.objects.all(), required=False) status = forms.ChoiceField(choices=add_blank_choice(CircuitStatusChoices), required=False, initial='', widget=StaticSelect()) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) commit_rate = forms.IntegerField(required=False, label='Commit rate (Kbps)') description = forms.CharField(max_length=100, required=False) comments = CommentField(widget=SmallTextarea, label='Comments') class Meta: nullable_fields = [ 'tenant', 'commit_rate', 'description', 'comments', ]
class VirtualMachineBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm): pk = forms.ModelMultipleChoiceField(queryset=VirtualMachine.objects.all(), widget=forms.MultipleHiddenInput()) status = forms.ChoiceField( choices=add_blank_choice(VirtualMachineStatusChoices), required=False, initial='', widget=StaticSelect(), ) cluster = DynamicModelChoiceField(queryset=Cluster.objects.all(), required=False) role = DynamicModelChoiceField( queryset=DeviceRole.objects.filter(vm_role=True), required=False, query_params={"vm_role": "True"}) tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False) platform = DynamicModelChoiceField(queryset=Platform.objects.all(), required=False) vcpus = forms.IntegerField(required=False, label='vCPUs') memory = forms.IntegerField(required=False, label='Memory (MB)') disk = forms.IntegerField(required=False, label='Disk (GB)') comments = CommentField(widget=SmallTextarea, label='Comments') class Meta: nullable_fields = [ 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'comments', ]