Ejemplo n.º 1
0
    class Meta:
        model = Recipes
        fields = [
            'user',
            'reName',
            'tag',
            'ingredient',
            'solution',
            'image',
        ]

        widgets = {
            'user': forms.MultipleHiddenInput()
        }
Ejemplo n.º 2
0
class TenantBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=Tenant.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    group = DynamicModelChoiceField(
        queryset=TenantGroup.objects.all(),
        required=False
    )

    class Meta:
        nullable_fields = [
            'group',
        ]
Ejemplo n.º 3
0
class ContactBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Contact.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    group = DynamicModelChoiceField(queryset=ContactGroup.objects.all(),
                                    required=False)
    title = forms.CharField(max_length=100, required=False)
    phone = forms.CharField(max_length=50, required=False)
    email = forms.EmailField(required=False)
    address = forms.CharField(max_length=200, required=False)

    class Meta:
        nullable_fields = [
            'group', 'title', 'phone', 'email', 'address', 'comments'
        ]
Ejemplo n.º 4
0
 def __init__(self, *args, **kwargs):
     super(CellTypeForm, self).__init__(*args,
                                        **kwargs,
                                        error_class=BootstrapErrorList)
     self.fields[FormFields.CELL_TYPE] = ModelMultipleChoiceField(
         queryset=CellType.objects.order_by('name'),
         widget=forms.SelectMultiple(attrs=FORM_CONTROL_ATTRS),
         label="Select one or more cell types",
     )
     self.fields[FormFields.TF_NAME] = ModelMultipleChoiceField(
         queryset=TranscriptionFactor.objects.order_by('name'),
         widget=forms.MultipleHiddenInput(),
         required=False,
         label="Select one or more transcription factors",
     )
Ejemplo n.º 5
0
class AggregateBulkEditForm(BootstrapMixin, AddRemoveTagsForm,
                            CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Aggregate.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    rir = forms.ModelChoiceField(queryset=RIR.objects.all(),
                                 required=False,
                                 label='RIR')
    date_added = forms.DateField(required=False)
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            'date_added',
            'description',
        ]
Ejemplo n.º 6
0
class DeviceTypeBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=DeviceType.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    manufacturer = DynamicModelChoiceField(queryset=Manufacturer.objects.all(),
                                           required=False)
    u_height = forms.IntegerField(min_value=1, required=False)
    is_full_depth = forms.NullBooleanField(required=False,
                                           widget=BulkEditNullBooleanSelect(),
                                           label='Is full depth')
    airflow = forms.ChoiceField(choices=add_blank_choice(DeviceAirflowChoices),
                                required=False,
                                widget=StaticSelect())

    class Meta:
        nullable_fields = ['airflow']
Ejemplo n.º 7
0
class InterfaceTemplateBulkEditForm(BulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=InterfaceTemplate.objects.all(),
        widget=forms.MultipleHiddenInput())
    label = forms.CharField(max_length=64, required=False)
    type = forms.ChoiceField(choices=add_blank_choice(InterfaceTypeChoices),
                             required=False,
                             widget=StaticSelect())
    mgmt_only = forms.NullBooleanField(required=False,
                                       widget=BulkEditNullBooleanSelect,
                                       label='Management only')
    description = forms.CharField(required=False)

    class Meta:
        nullable_fields = ('label', 'description')
Ejemplo n.º 8
0
class HiddenForm(forms.ModelForm):
    HIDDEN_LIST = (
        'Item 01',
        'Item 02',
        'Item 03',
        'Item 04',
        'Item 05',
        'Item 06',
    )
    dado = forms.CharField(widget=forms.MultipleHiddenInput(),
                           initial=HIDDEN_LIST)

    class Meta:
        model = Hidden
        fields = ('nome', 'dado')
Ejemplo n.º 9
0
class VRFBulkEditForm(AddRemoveTagsForm, CustomFieldModelBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=VRF.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(),
                                     required=False)
    enforce_unique = forms.NullBooleanField(required=False,
                                            widget=BulkEditNullBooleanSelect(),
                                            label='Enforce unique space')
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            'tenant',
            'description',
        ]
Ejemplo n.º 10
0
class AggregateBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Aggregate.objects.all(), widget=forms.MultipleHiddenInput())
    rir = DynamicModelChoiceField(queryset=RIR.objects.all(), required=False, label="RIR")
    tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
    date_added = forms.DateField(required=False)
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            "date_added",
            "description",
        ]
        widgets = {
            "date_added": DatePicker(),
        }
Ejemplo n.º 11
0
class IPAddressBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=IPAddress.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    vrf = DynamicModelChoiceField(
        queryset=VRF.objects.all(),
        required=False,
        label='VRF'
    )
    mask_length = forms.IntegerField(
        label='mask_length',
        min_value=IPADDRESS_MASK_LENGTH_MIN,
        max_value=IPADDRESS_MASK_LENGTH_MAX,
        required=False
    )
    tenant = DynamicModelChoiceField(
        label='Учреждение',
        queryset=Tenant.objects.all(),
        required=False
    )
    status = forms.ChoiceField(
        label='Статус',
        choices=add_blank_choice(IPAddressStatusChoices),
        required=False,
        widget=StaticSelect2()
    )
    role = forms.ChoiceField(
        label='Роль',
        choices=add_blank_choice(IPAddressRoleChoices),
        required=False,
        widget=StaticSelect2()
    )
    dns_name = forms.CharField(
        label='dns_name',
        max_length=255,
        required=False
    )
    description = forms.CharField(
        label='Описание',
        max_length=100,
        required=False
    )

    class Meta:
        nullable_fields = [
            'vrf', 'role', 'tenant', 'dns_name', 'description',
        ]
Ejemplo n.º 12
0
class IPAddressBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=IPAddress.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    vrf = forms.ModelChoiceField(
        queryset=VRF.objects.all(),
        required=False,
        label='VRF',
        widget=APISelect(
            api_url="/api/ipam/vrfs/"
        )
    )
    mask_length = forms.IntegerField(
        min_value=1,
        max_value=128,
        required=False
    )
    tenant = forms.ModelChoiceField(
        queryset=Tenant.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/tenancy/tenants/"
        )
    )
    status = forms.ChoiceField(
        choices=add_blank_choice(IPADDRESS_STATUS_CHOICES),
        required=False,
        widget=StaticSelect2()
    )
    role = forms.ChoiceField(
        choices=add_blank_choice(IPADDRESS_ROLE_CHOICES),
        required=False,
        widget=StaticSelect2()
    )
    dns_name = forms.CharField(
        max_length=255,
        required=False
    )
    description = forms.CharField(
        max_length=100,
        required=False
    )

    class Meta:
        nullable_fields = [
            'vrf', 'role', 'tenant', 'dns_name', 'description',
        ]
Ejemplo n.º 13
0
    def __init__(self, user, *args, **kwargs):
        super(NewArticleForm, self).__init__(*args, **kwargs)  # pylint: disable=E1002
        choices = get_article_templates(None, user)
        if choices:
            self.fields["template"] = forms.ChoiceField(choices=choices)
        else:
            self.fields["template"] = forms.CharField()
        self.fields["title"].required = True
        self.fields["title"].widget = forms.TextInput(attrs={'size': 30})

        self.fields['category'].queryset = self.fields['category'].queryset.filter(sites=settings.SITE_ID)

        if 'sites' in self.fields:
            self.fields['sites'].initial = self.get_initials('sites')
            if not is_multi_site():
                self.fields['sites'].widget = forms.MultipleHiddenInput()
Ejemplo n.º 14
0
 def __init__(self, *args, **kwargs):
     super(PersonActivityTimeSheetForm, self).__init__(*args, **kwargs)
     if 'initial' in kwargs:
         self.fields[
             'work_packages'].queryset = ProjectWorkPackage.objects.filter(
                 project=kwargs['initial']['project'])
         self.fields['project'].choices = ((kwargs['initial']['project'].id,
                                            kwargs['initial']['project']), )
         self.fields['activity'].choices = (
             (kwargs['initial']['activity'].id,
              kwargs['initial']['activity']), )
     if self.fields['work_packages'].choices.__len__() == 0:
         self.fields['work_packages'].widget = forms.MultipleHiddenInput()
     else:
         self.fields['work_packages'].widget = forms.CheckboxSelectMultiple(
             choices=self.fields['work_packages'].choices)
Ejemplo n.º 15
0
class InterfaceBulkEditForm(BootstrapMixin, BulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Interface.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    enabled = forms.NullBooleanField(required=False,
                                     widget=BulkEditNullBooleanSelect())
    mtu = forms.IntegerField(required=False,
                             min_value=1,
                             max_value=32767,
                             label='MTU')
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            'mtu',
            'description',
        ]
class EditGovernmentOrganisationsForm(forms.Form):
    organisations = forms.MultipleChoiceField(
        label="", choices=[], widget=forms.MultipleHiddenInput(), required=False,
    )

    def __init__(self, barrier_id, organisations, *args, **kwargs):
        self.token = kwargs.pop("token")
        self.barrier_id = barrier_id
        super().__init__(*args, **kwargs)
        self.fields["organisations"].choices = organisations

    def save(self):
        client = MarketAccessAPIClient(self.token)
        client.barriers.patch(
            id=self.barrier_id, government_organisations=self.cleaned_data["organisations"],
        )
Ejemplo n.º 17
0
class ClusterBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Cluster.objects.all(), widget=forms.MultipleHiddenInput())
    type = DynamicModelChoiceField(queryset=ClusterType.objects.all(), required=False)
    group = DynamicModelChoiceField(queryset=ClusterGroup.objects.all(), required=False)
    tenant = DynamicModelChoiceField(queryset=Tenant.objects.all(), required=False)
    region = DynamicModelChoiceField(queryset=Region.objects.all(), required=False, to_field_name="slug")
    site = DynamicModelChoiceField(queryset=Site.objects.all(), required=False, query_params={"region": "$region"})
    comments = CommentField(widget=SmallTextarea, label="Comments")

    class Meta:
        nullable_fields = [
            "group",
            "site",
            "comments",
            "tenant",
        ]
Ejemplo n.º 18
0
class ServiceBulkEditForm(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',
        ]
Ejemplo n.º 19
0
class VLANBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=VLAN.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    site = forms.ModelChoiceField(
        queryset=Site.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/dcim/sites/"
        )
    )
    group = forms.ModelChoiceField(
        queryset=VLANGroup.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/ipam/vlan-groups/"
        )
    )
    tenant = forms.ModelChoiceField(
        queryset=Tenant.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/tenancy/tenants/"
        )
    )
    status = forms.ChoiceField(
        choices=add_blank_choice(VLAN_STATUS_CHOICES),
        required=False,
        widget=StaticSelect2()
    )
    role = forms.ModelChoiceField(
        queryset=Role.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/ipam/roles/"
        )
    )
    description = forms.CharField(
        max_length=100,
        required=False
    )

    class Meta:
        nullable_fields = [
            'site', 'group', 'tenant', 'role', 'description',
        ]
Ejemplo n.º 20
0
class VLANBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=VLAN.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    region = DynamicModelChoiceField(
        queryset=Region.objects.all(),
        required=False,
        to_field_name='slug'
    )
    site = DynamicModelChoiceField(
        queryset=Site.objects.all(),
        required=False,
        query_params={
            'region': '$region'
        }
    )
    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=StaticSelect2()
    )
    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',
        ]
Ejemplo n.º 21
0
class TenantBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=Tenant.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    group = forms.ModelChoiceField(
        queryset=TenantGroup.objects.all(),
        required=False,
        widget=APISelect(
            api_url="/api/tenancy/tenant-groups/"
        )
    )

    class Meta:
        nullable_fields = [
            'group',
        ]
Ejemplo n.º 22
0
class ClusterBulkEditForm(BootstrapMixin, AddRemoveTagsForm,
                          CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Cluster.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    type = forms.ModelChoiceField(queryset=ClusterType.objects.all(),
                                  required=False)
    group = forms.ModelChoiceField(queryset=ClusterGroup.objects.all(),
                                   required=False)
    site = forms.ModelChoiceField(queryset=Site.objects.all(), required=False)
    comments = CommentField(widget=SmallTextarea())

    class Meta:
        nullable_fields = [
            'group',
            'site',
            'comments',
        ]
Ejemplo n.º 23
0
    def __init__(self, *args, **kwargs):
        if 'hidden' in kwargs:
            self.hidden = kwargs.pop('hidden')
        else:
            self.hidden = False
        super(SessionForm, self).__init__(*args, **kwargs)
        self.fields['num_session'].widget.attrs[
            'onChange'] = "stat_ls(this.selectedIndex);"
        self.fields['length_session1'].widget.attrs[
            'onClick'] = "if (check_num_session(1)) this.disabled=true;"
        self.fields['length_session2'].widget.attrs[
            'onClick'] = "if (check_num_session(2)) this.disabled=true;"
        self.fields['length_session3'].widget.attrs[
            'onClick'] = "if (check_third_session()) { this.disabled=true;}"
        self.fields['comments'].widget = forms.Textarea(attrs={
            'rows': '6',
            'cols': '65'
        })
        self.fields['wg_selector1'].widget.attrs[
            'onChange'] = "document.form_post.conflict1.value=document.form_post.conflict1.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(1);"
        self.fields['wg_selector2'].widget.attrs[
            'onChange'] = "document.form_post.conflict2.value=document.form_post.conflict2.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(2);"
        self.fields['wg_selector2'].widget.attrs[
            'onClick'] = "return check_prior_conflict(2);"
        self.fields['wg_selector3'].widget.attrs[
            'onChange'] = "document.form_post.conflict3.value=document.form_post.conflict3.value + ' ' + this.options[this.selectedIndex].value; return handleconflictfield(3);"
        self.fields['wg_selector3'].widget.attrs[
            'onClick'] = "return check_prior_conflict(3);"
        self.fields['third_session'].widget.attrs[
            'onClick'] = "if (document.form_post.num_session.selectedIndex < 2) { alert('Cannot use this field - Number of Session is not set to 2'); return false; } else { if (this.checked==true) { document.form_post.length_session3.disabled=false; } else { document.form_post.length_session3.value=0;document.form_post.length_session3.disabled=true; } }"
        self.fields["resources"].choices = [
            (x.pk, x.desc) for x in ResourceAssociation.objects.filter(
                name__used=True).order_by('name__order')
        ]

        # check third_session checkbox if instance and length_session3
        # assert False, (self.instance, self.fields['length_session3'].initial)
        if self.initial and 'length_session3' in self.initial:
            if self.initial['length_session3'] != '0' and self.initial[
                    'length_session3'] != None:
                self.fields['third_session'].initial = True

        if self.hidden:
            for key in self.fields.keys():
                self.fields[key].widget = forms.HiddenInput()
            self.fields['resources'].widget = forms.MultipleHiddenInput()
Ejemplo n.º 24
0
class RouteTargetBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldModelBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=RouteTarget.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    tenant = DynamicModelChoiceField(
        queryset=Tenant.objects.all(),
        required=False
    )
    description = forms.CharField(
        max_length=200,
        required=False
    )

    class Meta:
        nullable_fields = [
            'tenant', 'description',
        ]
Ejemplo n.º 25
0
class ServiceBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Service.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    protocol = forms.ChoiceField(
        choices=add_blank_choice(ServiceProtocolChoices),
        required=False,
        widget=StaticSelect2())
    port = forms.IntegerField(validators=[
        MinValueValidator(1),
        MaxValueValidator(65535),
    ],
                              required=False)
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            'description',
        ]
Ejemplo n.º 26
0
class SecretBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=Secret.objects.all(),
        widget=forms.MultipleHiddenInput()
    )
    role = DynamicModelChoiceField(
        queryset=SecretRole.objects.all(),
        required=False
    )
    name = forms.CharField(
        max_length=100,
        required=False
    )

    class Meta:
        nullable_fields = [
            'name',
        ]
Ejemplo n.º 27
0
class PowerPortTemplateBulkEditForm(BulkEditForm):
    pk = forms.ModelMultipleChoiceField(
        queryset=PowerPortTemplate.objects.all(),
        widget=forms.MultipleHiddenInput())
    label = forms.CharField(max_length=64, required=False)
    type = forms.ChoiceField(choices=add_blank_choice(PowerPortTypeChoices),
                             required=False,
                             widget=StaticSelect())
    maximum_draw = forms.IntegerField(min_value=1,
                                      required=False,
                                      help_text="Maximum power draw (watts)")
    allocated_draw = forms.IntegerField(
        min_value=1, required=False, help_text="Allocated power draw (watts)")
    description = forms.CharField(required=False)

    class Meta:
        nullable_fields = ('label', 'type', 'maximum_draw', 'allocated_draw',
                           'description')
Ejemplo n.º 28
0
    def __init__(self, data=None, files=None, **kwargs):
        """

        @param project: Restrict list of codingjobs to this project
        @type project: models.Project
        """
        codingjobs = kwargs.pop("codingjobs", None)
        export_level = kwargs.pop("export_level", None)
        super(CodingJobResultsForm, self).__init__(data, files, **kwargs)

        if codingjobs is None:  # is this necessary?
            data = self.data.getlist("codingjobs", codingjobs)
            codingjobs = self.fields["codingjobs"].clean(data)
        if export_level is None:
            export_level = int(self.fields["export_level"].clean(
                self.data['export_level']))

        # Hide fields from step (1)
        self.fields["codingjobs"].widget = forms.MultipleHiddenInput()
        self.fields["export_level"].widget = forms.HiddenInput()

        subsentences = CodingSchema.objects.filter(
            codingjobs_unit__in=codingjobs, subsentences=True).exists()

        # Add meta fields
        for field in _METAFIELDS:
            if field.object == "sentence" and export_level == CODING_LEVEL_ARTICLE:
                continue
            if field.object == "subsentence" and (
                    export_level == CODING_LEVEL_ARTICLE or not subsentences):
                continue

            self.fields["meta_{field.object}_{field.attr}".format(
                **locals())] = forms.BooleanField(
                    initial=True,
                    required=False,
                    label="Include {field.label}".format(**locals()))

        # Insert dynamic fields based on schemafields
        self.schemafields = _get_schemafields(codingjobs, export_level)
        self.fields.update(self.get_form_fields(self.schemafields))
        self.fields.update(dict(self.get_aggregation_fields()))
        self.fields.update(dict(self.get_date_fields()))
Ejemplo n.º 29
0
class AggregateBulkEditForm(BootstrapMixin, AddRemoveTagsForm,
                            CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Aggregate.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    rir = DynamicModelChoiceField(queryset=RIR.objects.all(),
                                  required=False,
                                  label='RIR',
                                  widget=APISelect(api_url="/api/ipam/rirs/"))
    date_added = forms.DateField(required=False)
    description = forms.CharField(max_length=100, required=False)

    class Meta:
        nullable_fields = [
            'date_added',
            'description',
        ]
        widgets = {
            'date_added': DatePicker(),
        }
Ejemplo n.º 30
0
class VirtualMachineBulkEditForm(BootstrapMixin, AddRemoveTagsForm,
                                 CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=VirtualMachine.objects.all(),
                                        widget=forms.MultipleHiddenInput())
    status = forms.ChoiceField(
        choices=add_blank_choice(VM_STATUS_CHOICES),
        required=False,
        initial='',
        widget=StaticSelect2(),
    )
    cluster = forms.ModelChoiceField(
        queryset=Cluster.objects.all(),
        required=False,
        widget=APISelect(api_url='/api/virtualization/clusters/'))
    role = forms.ModelChoiceField(
        queryset=DeviceRole.objects.filter(vm_role=True),
        required=False,
        widget=APISelect(api_url="/api/dcim/device-roles/",
                         additional_query_params={"vm_role": "True"}))
    tenant = forms.ModelChoiceField(
        queryset=Tenant.objects.all(),
        required=False,
        widget=APISelect(api_url='/api/tenancy/tenants/'))
    platform = forms.ModelChoiceField(
        queryset=Platform.objects.all(),
        required=False,
        widget=APISelect(api_url='/api/dcim/platforms/'))
    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())

    class Meta:
        nullable_fields = [
            'role',
            'tenant',
            'platform',
            'vcpus',
            'memory',
            'disk',
            'comments',
        ]