示例#1
0
class TaskForm(forms.ModelForm):
    class Meta:
        model = Task
        fields = ("user", "title", "description", "complete", "admin_task")
        labels = {
            "user": "******",
            "title": "Título",
            "description": "Descripción",
            "complete": "Estado",
            "admin_task": "Tarea enviada por administrador",
        }

    widgets = {
        "user":
        forms.TextInput(attrs={
            'class': 'form-control',
        }),
        "title":
        forms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Título de la tarea'
        }),
        "description":
        forms.Textarea(
            attrs={
                'class': 'form-control',
                'placeholder': 'Ingrese la descripción de la tarea'
            }),
        "complete":
        forms.NullBooleanSelect(attrs={
            "class": "form-control",
        }),
        "admin_task":
        forms.NullBooleanSelect(attrs={"class": "form-control"})
    }
示例#2
0
class EditClientForm(forms.Form):
    name = forms.CharField(required=True,
                           widget=forms.TextInput(attrs=formWidgetAttrs.name))
    address = forms.CharField(
        required=False, widget=forms.TextInput(attrs=formWidgetAttrs.address))
    phone_home = forms.CharField(
        label='Phone (Home)',
        required=False,
        widget=forms.TextInput(attrs=formWidgetAttrs.phone))
    phone_cell = forms.CharField(
        label='Phone (Cell)',
        required=False,
        widget=forms.TextInput(attrs=formWidgetAttrs.phone))
    elderly = forms.NullBooleanField(
        required=False,
        widget=forms.NullBooleanSelect(attrs=formWidgetAttrs.default))
    ambulatory = forms.NullBooleanField(
        required=False,
        widget=forms.NullBooleanSelect(attrs=formWidgetAttrs.default))
    tags = forms.CharField(required=False, widget=forms.HiddenInput())
    staff = forms.ChoiceField(
        choices=BOOL_CHOICES,
        label='Is staff member?',
        required=True,
        widget=forms.Select(attrs=formWidgetAttrs.default))
    is_active = forms.ChoiceField(
        choices=BOOL_CHOICES,
        label='Is active?',
        help_text=
        'Inactive clients will not appear in autocomplete drop-downs.',
        required=True,
        widget=forms.Select(attrs=formWidgetAttrs.default))
示例#3
0
 def __init__(self, *args, **kwargs):
     super(PartoForm, self).__init__(*args, **kwargs)
     self.fields['ci_paciente'].widget = forms.TextInput(
         attrs={
             'class': 'form-control',
             'placeholder': 'Cedula de Identidad',
             'tabindex': '1'
         })
     self.fields['motivo_consulta'].widget = forms.TextInput(attrs={
         'class': 'form-control',
         'placeholder': 'Motivo',
         'tabindex': '2'
     })
     self.fields['presenta'].widget = forms.TextInput(
         attrs={
             'class': 'form-control',
             'placeholder': 'Enfermedad Actual',
             'tabindex': '3'
         })
     self.fields['diagnostico'].widget = forms.TextInput(attrs={
         'class': 'form-control',
         'placeholder': 'Diagnostico',
         'tabindex': '4'
     })
     self.fields['controles'].widget = forms.NumberInput(
         attrs={
             'class': 'form-control',
             'placeholder': 'Numero de Controles',
             'min': '0',
             'pattern': '^[0-9]+',
             'tabindex': '27'
         })
     self.fields['deseado'].widget = forms.NullBooleanSelect(
         attrs={
             'class': 'form-control',
             'tabindex': '28'
         })
     self.fields['planificado'].widget = forms.NullBooleanSelect(
         attrs={
             'class': 'form-control',
             'tabindex': '29'
         })
     self.fields['controlado'].widget = forms.NullBooleanSelect(
         attrs={
             'class': 'form-control',
             'tabindex': '30'
         })
     self.fields['itu'].widget = forms.NullBooleanSelect(attrs={
         'class': 'form-control',
         'tabindex': '31'
     })
     self.fields['laboratorio'].widget = forms.Textarea(
         attrs={
             'class': 'form-control',
             'placeholder': 'Laboratorio',
             'tabindex': '32'
         })
示例#4
0
    class Meta:
        model = Food
        fields = ('name', 'description', 'instructions', 'notes', 'food_tags',
                  'food_priority', 'food_category', 'prep_time', 'cook_time',
                  'is_feature', 'is_headline', 'is_sideline', 'ingredients',
                  'food_main_image')

        widgets = {
            'name':
            forms.TextInput(attrs={'class': 'form-control'}),
            'description':
            CKEditorWidget(attrs={
                'class': 'form-control',
            }),
            'instructions':
            CKEditorWidget(attrs={
                'class': 'form-control',
            }),
            'notes':
            CKEditorWidget(attrs={
                'class': 'form-control',
            }),
            'food_tags':
            Select2MultipleWidget(attrs={
                'class': 'form-control ',
                'placeholder': 'Select here'
            }),
            'food_priority':
            forms.NumberInput(attrs={'class': 'form-control'}),
            'food_category':
            forms.Select(
                attrs={
                    'class': 'form-control glyphicon glyphicon-plus',
                    'placeholder': 'Select here'
                }),
            'prep_time':
            forms.NumberInput(attrs={'class': 'form-control'}),
            'cook_time':
            forms.NumberInput(attrs={'class': 'form-control'}),
            'is_feature':
            forms.NullBooleanSelect(attrs={'class': 'form-control'}),
            'is_headline':
            forms.NullBooleanSelect(attrs={'class': 'form-control'}),
            'is_sideline':
            forms.NullBooleanSelect(attrs={'class': 'form-control'}),
            'ingredients':
            CKEditorWidget(attrs={
                'class': 'form-control',
            }),
            'food_main_image':
            forms.FileInput(attrs={'class': 'form-control'}),
        }
示例#5
0
class TareaForm(forms.ModelForm):
    # fecha_vencimiento = forms.DateField(widget=forms.DateInput(format=('%d-%m-%Y'), attrs={'type':'date', 'class':'form-control',
    #    'placeholder':'mas q las paloma'}))
    class Meta:
        model = Tarea
        fields = [
            'titulo',
            'comentario',
            # 'fecha_vencimiento',
            # 'fecha_creacion',
            # 'fecha_modificacion',
            'trabajador',
        ]

        labels = {
            'titulo': 'Titulo',
            'comentario': 'Descripcion',
            # 'fecha_vencimiento' : 'fecha_vencimiento',
            'estado': 'Estado',
            'trabajador': 'Trabajador'
            # 'fecha_creacion' : 'Fecha de creacion',
        }

    widgets = {
        'titulo': forms.TextInput(attrs={'class': 'form-control'}),
        'comentario': forms.Textarea(attrs={'class': 'form-control'}),
        # 'fecha_vencimiento':  forms.DateInput(attrs={'class':'datepicker'}),
        'estado': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        'trabajador': forms.Select(attrs={'class': 'form-control'}),
    }
示例#6
0
    class Meta:
        model = Articulo

        fields = [
            'categoria',
            'nombre_articulo',
            'precio',
            'estado',
            'existencia',
            'descripcion',
            #'imagen_articulo',
            'vendible',
        ]

        labels = {
            'categoria': 'Categoria',
            'nombre_articulo': 'Nombre Articulo',
            'precio': 'Precio',
            'estado': 'Estado Articulo',
            'existencia': 'Existencia',
            'descripcion': 'Descripcion',
            'vendible': '¿Es Vendible?',
            #'imagen_articulo': 'Imagen',
        }

        widgets = {
            'categoria': forms.Select(attrs={'class': 'form-control', 'value': 'Seleccione Categoria'}),
            'nombre_articulo': forms.TextInput(attrs={'class': 'form-control'}),
            'precio': forms.TextInput(attrs={'class': 'form-control'}),
            'estado': forms.TextInput(attrs={'class': 'form-control'}),
            'existencia': forms.TextInput(attrs={'class': 'form-control'}),
            'descripcion': forms.TextInput(attrs={'class': 'form-control'}),
            'vendible': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
            #'imagen_articulo': forms.FileInput(),
        }
示例#7
0
    class Meta:
        model = Provider
        fields = '__all__'

        labels = {
            'street': 'calle',
            'ext_no': 'Número Exterior',
            'int_no': 'número Interior',
            'colony': 'Colonia',
            'municipality': 'Municipio',
            'state': 'Estado',
            'country': 'Pais',
            'zipcode': 'Codigo Postal',
            'rfc': 'RFC',
            'name': 'Nombre Completo',
            'bank_account_no': 'Número de Cuenta bancaria',
            'clabe': 'CLABE',
            'bank_name': 'Nombre del banco',
            'telephone1': 'Telefono 1',
            'telephone2': 'Telefono 2',
            'telephone3': 'Telefono 3',
            'email': 'E-mail',
            'contact_name': 'Nombre de contacto',
            'website': 'Sitio Web',
            'region': 'Región',
            'credit': '¿Otorga credito?',
            'credit_days': 'Dias de credito',
            'money_owed': 'Saldo ',
        }

        widgets = {
            'credit': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        }
示例#8
0
 class Meta:
     widgets = {
         'site': forms.Select(attrs={
             'class': 'col-xs-5',
         }),
         'name': forms.TextInput(attrs={
             'class': 'col-xs-7',
         }),
         'email': forms.TextInput(attrs={
             'class': 'col-xs-5',
         }),
         'phone': forms.TextInput(attrs={
             'class': 'col-xs-5',
         }),
         'subject': forms.TextInput(attrs={
             'class': 'col-xs-7',
         }),
         'order_state': forms.NullBooleanSelect(attrs={
             'class': 'col-xs-2',
         }),
         'note': forms.Textarea(attrs={
             'rows': 3,
             'class': 'col-xs-7',
         }),
         'agent': forms.Select(attrs={
             'class': 'col-xs-5',
         }),
     }
示例#9
0
class ProductForm(forms.ModelForm):

    AXE_CHOICES = Product.AXE_CHOICES

    qs = Type.objects.all()
    type = forms.ModelChoiceField(queryset=qs,
                                  empty_label='Choisissez le type de lentille')
    sphere = forms.DecimalField(
        label='sphere',
        required=False,
        widget=forms.NumberInput(attrs={'class': 'form-control'}))

    cylindre = forms.DecimalField(
        label='cylindre',
        required=False,
        widget=forms.NumberInput(attrs={'class': 'form-control'}))

    axe = forms.ChoiceField(
        label='axe',
        required=False,
        choices=AXE_CHOICES,
        widget=forms.NullBooleanSelect(attrs={'class': 'form-control'}))

    addition = forms.IntegerField(
        label='Addition',
        required=False,
        widget=forms.NumberInput(attrs={'class': 'form-control'}))

    class Meta:
        model = Product
        fields = ['type', 'sphere', 'cylindre', 'axe', 'addition']
示例#10
0
文件: forms.py 项目: TKCERT/dfirtrack
    class Meta(SystemExtendedBaseForm.Meta):

        # this HTML forms are shown
        fields = SystemExtendedBaseForm.Meta.fields + (
            'host_system',
            'recommendation',
            'system_deprecated_time',
            'system_export_markdown',
            'system_export_spreadsheet',
            'system_install_time',
            'system_is_vm',
            'system_lastbooted_time',
        )

        # non default form labeling
        labels = {
            'system_deprecated_time': gettext_lazy('System is deprecated since (YYYY-MM-DD HH:MM:SS)'),
            'system_export_markdown': gettext_lazy('Export system to markdown'),
            'system_export_spreadsheet': gettext_lazy('Export system to spreadsheet'),
            'system_install_time': gettext_lazy('Installation time (YYYY-MM-DD HH:MM:SS)'),
            'system_is_vm': gettext_lazy('System is a VM'),
            'system_lastbooted_time': gettext_lazy('Last booted (YYYY-MM-DD HH:MM:SS)'),
        }

        # special form type or option
        widgets = {
            'host_system': forms.Select(),
            'system_deprecated_time': forms.DateTimeInput(),
            'system_install_time': forms.DateTimeInput(),
            'system_is_vm': forms.NullBooleanSelect(),
            'system_lastbooted_time': forms.DateTimeInput(),
        }
示例#11
0
    class Meta:
        model = Materia

        fields = [
            'grado',
            'nombre',
            'Descripcion',
            'status',
            'photo',
        ]

        exclude = {'grado'}

        labels = {
            'nombre': 'Escribe el nombre de la Materia',
            'Descripcion': 'Escribe una descripcion de la materia',
            'status': '¿Esta activa la materia?',
            'photo': 'Agregar una imagen'
        }

        widgets = {
            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
            'Descripcion': forms.Textarea(attrs={'class': 'form-control'}),
            'status': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        }
示例#12
0
    class Meta:
        model = ContentTema

        fields = [
            'tema',
            'Descripcion',
            'status',
            'photo',
            'video',
        ]

        exclude = {'tema'}

        labels = {
            'Contenido': 'Escribe el contenido del tema',
            'status': '¿Es visible el Contenido?',
            'photo': 'elige una imagen',
            'video': 'pega la url de un video',
        }

        widgets = {
            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
            'Descripcion': forms.Textarea(attrs={'class': 'form-control'}),
            'status': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        }
示例#13
0
    class Meta:
        model = Temas

        fields = [
            'materia',
            'nombre',
            'Descripcion',
            'status',
            'photo',
        ]

        exclude = {'materia'}

        labels = {
            'nombre': 'Escribe el nombre de el tema',
            'Descripcion': 'Escribe una descripcion de el tema ',
            'status': '¿Esta activa el tema?',
            'photo': 'elige una imagen',
        }

        widgets = {
            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
            'Descripcion': forms.Textarea(attrs={'class': 'form-control'}),
            'status': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        }
示例#14
0
 class Meta:
     # Takes all Assignment Fields
     model = Assignment
     fields = [
         'employee', 'task', 'start', 'end', 'percentage', 'responsibility',
         'comment'
     ]
     # Define the html input types
     widgets = {
         'employee':
         forms.Select(attrs={'class': 'form-control'}),
         'task':
         forms.Select(attrs={'class': 'form-control'}),
         'start':
         forms.DateInput(attrs={'class': 'form-control'}),
         'end':
         forms.DateInput(attrs={'class': 'form-control'}),
         'percentage':
         forms.NumberInput(attrs={
             'class': 'form-control',
             'step': '0.01',
             'max': 1.0,
             'min': 0.0
         }),
         'responsibility':
         forms.NullBooleanSelect(attrs={'class': 'form-control'}),
         'comment':
         forms.TextInput(attrs={'class': 'form-control'}),
     }
示例#15
0
    class Meta:
        model = UserGrupo

        fields = [
            'maestro',
            'nombre',
            'Descripcion',
            'photo',
            'status',
        ]

        exclude = {'maestro'}

        labels = {
            'nombre': 'Cual es el nombre',
            'Descripcion': 'Pon una pequeña descripcion',
            'photo': 'Pon una foto de portada chida',
            'status': '¿visible?',
        }

        widgets = {
            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
            'Descripcion': forms.Textarea(attrs={'class': 'form-control'}),
            'status': forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        }
示例#16
0
 class Meta:
     model = Session
     fields = [
         'genome_index', 'genome', 'organism', 'salmon', 'fasta_dna_file',
         'fasta_cdna_file', 'gtf_file', 'status', 'reactome'
     ]
     # fields='__all__'
     widgets = {
         'genome_index':
         forms.Select(attrs={
             'class': 'form-control',
         }),
         'genome':
         forms.Select(attrs={
             'class': 'form-control',
         }),
         'organism':
         forms.TextInput(
             attrs={
                 'class': 'form-control',
                 'placeholder': 'enter organism name here...'
             }),
         'salmon':
         forms.NullBooleanSelect(attrs={
             'class': 'form-control',
         }),
     }
示例#17
0
 class Meta:
     model = HappyEnding
     fields = [
         'name',
         'status',
         'adoption_date',
         'adoption_image',
     ]
     widgets = {
         'name':
         forms.TextInput(attrs={
             'class': 'input',
             'placeholder': 'e.g. Buddy',
             'required': True
         }),
         'status':
         forms.NullBooleanSelect(attrs={'class': 'input'}),
         'adoption_date':
         forms.TextInput(
             attrs={
                 'class': 'input',
                 'placeholder': 'Day of the adoption e.g. 20 January 2020',
                 'required': True
             }),
     }
示例#18
0
    class Meta:
        model = DynamicSaveInputs
        exclude = ['creation_date']
        widgets = {}
        labels = {}
        for param in OGUSA_DEFAULT_PARAMS.values():
            for field in param.col_fields:
                attrs = {
                    'class': 'form-control',
                    'placeholder': field.default_value,
                }

                if param.coming_soon:
                    attrs['disabled'] = True
                    attrs['checked'] = False
                    widgets[field.id] = forms.CheckboxInput(
                        attrs=attrs, check_test=bool_like)
                else:
                    widgets[field.id] = forms.TextInput(attrs=attrs)

                labels[field.id] = field.label

            if param.inflatable:
                field = param.cpi_field
                attrs = {
                    'class': 'form-control sr-only',
                    'placeholder': bool(field.default_value),
                }

                if param.coming_soon:
                    attrs['disabled'] = True

                widgets[field.id] = forms.NullBooleanSelect(attrs=attrs)
示例#19
0
    class Meta:
        model = Persona
        fields = [
            'nombre',
            'apellido',
            'cedula',
            'edad',
            'telefono',
            'email',
            'domicilio',
            'personaEPN',
        ]
        labels = {
            'nombre': 'Nombre',
            'apellido': 'Apellido',
            'cedula': 'Cedula',
            'edad': 'Edad',
            'telefono': 'Telefono',
            'email': 'Correo electrónico',
            'domicilio': 'Dirección domiciliaria',
            'personaEPN': 'Usted pertenece a la E.P:N.?',
        }

        widgets = {
            'nombre': forms.TextInput(attrs={'class': 'form-control'}),
            'apellido': forms.TextInput(attrs={'class': 'form-control'}),
            'cedula': forms.TextInput(attrs={'class': 'form-control'}),
            'edad': forms.TextInput(attrs={'class': 'form-control'}),
            'telefono': forms.TextInput(attrs={'class': 'form-control'}),
            'email': forms.EmailInput(attrs={'class': 'form-control'}),
            'domicilio': forms.TextInput(attrs={'class': 'form-control'}),
            'personaEPN': forms.NullBooleanSelect(),
        }
示例#20
0
class NullBooleanForm(forms.Form):
    null_boolean_field = forms.NullBooleanField(
        label='Gender',
        label_suffix=" : ",
        required=True,
        disabled=False,
        widget=forms.NullBooleanSelect(attrs={'class': 'form-control'}),
        error_messages={'required': "This field is required."})
示例#21
0
文件: forms.py 项目: junior12ag/peps
    class Meta:
        model = SolicitudAdopcion
        fields = [
            'nombre', 'apellidos', 'email', 'sexo', 'edad', 'identificacion',
            'direccion', 'razon', 'fecha', 'mascota', 'telefono', 'ocupacion',
            'estado'
        ]

        labels = {
            'nombre': 'Nombre',
            'apellidos': 'Apellidos',
            'email': 'Email',
            'sexo': 'Sexo',
            'edad': 'Edad',
            'identificacion': 'Identificacion',
            'direccion': 'Direccion',
            'razon': 'Razones',
            'fecha': 'Fecha',
            'mascota': 'Numero Mascota',
            'telefono': 'Telefono',
            'ocupacion': 'Ocupacion',
            'estado': 'Estado',
        }

        widgets = {
            'nombre':
            forms.TextInput(attrs={'class': 'form-control'}),
            'apellidos':
            forms.TextInput(attrs={'class': 'form-control'}),
            'email':
            forms.TextInput(attrs={'class': 'form-control'}),
            'sexo':
            forms.TextInput(attrs={'class': 'form-control'}),
            'edad':
            forms.TextInput(attrs={'class': 'form-control'}),
            'identificacion':
            forms.TextInput(attrs={'class': 'form-control'}),
            'direccion':
            forms.Textarea(attrs={'class': 'form-control'}),
            'razon':
            forms.Textarea(attrs={'class': 'form-control'}),
            'fecha':
            forms.DateInput(attrs={
                'class': 'from-control',
                'readonly': 'readonly'
            }),
            'mascota':
            forms.TextInput(attrs={
                'class': 'form-control',
                'readonly': 'readonly'
            }),
            'telefono':
            forms.TextInput(attrs={'class': 'form-control'}),
            'ocupacion':
            forms.Textarea(attrs={'class': 'form-control'}),
            'estado':
            forms.NullBooleanSelect(),
        }
示例#22
0
文件: forms.py 项目: I-TECH-UW/mwachx
    class Meta:
        # todo: can this be changed to a swappable version?
        model = cont.Contact
        exclude = ['status', 'facility']

        widgets = {
            # validation
            'study_id':
            forms.TextInput(attrs={
                'ng-pattern': '/^(\d{4}|25\d{6}0)$/',
                'required': True
            }),

            # TODO: Update this to be dependent on facility of logged in user
            'anc_num':
            forms.TextInput(attrs={
                'ng-pattern': '/^\d{4}|(\d{2,}\/)+\d{2,}$/',
                'required': True
            }),
            'ccc_num':
            forms.TextInput(attrs={'required': True}),
            'previous_pregnancies':
            forms.NumberInput(attrs={
                'min': '0',
                'max': '15'
            }),
            'study_group':
            forms.Select(attrs={'required': True}),
            'send_day':
            forms.Select(attrs={'required': True}),
            'send_time':
            forms.Select(attrs={'required': True}),
            'condition':
            forms.Select(attrs={'required': True}),
            'nickname':
            forms.TextInput(attrs={'required': True}),
            'language':
            forms.Select(attrs={'required': True}),
            'hiv_disclosed':
            forms.NullBooleanSelect(attrs={'required': True}),
            'phone_shared':
            forms.NullBooleanSelect(attrs={'required': True}),
            'hiv_messaging':
            forms.Select(attrs={'required': True}),
        }
示例#23
0
 class Meta:
     model = models.MobilityHabitsSurvey
     fields = (
         "end_user",
         "public_transport_usage",
         "uses_bike_sharing_services",
         "uses_electrical_car_sharing_services",
         "uses_fuel_car_sharing_services",
         "bicycle_usage",
     )
     widgets = {
         "end_user": forms.HiddenInput(),
         "public_transport_usage": forms.Select(
             attrs={
                 "class": "js-states form-control select_2",
                 "id": "select2",
             }
         ),
         "uses_bike_sharing_services": forms.NullBooleanSelect(
             attrs={
                 "class": "js-states form-control select_2",
                 "id": "select2",
             }
         ),
         "uses_electrical_car_sharing_services": forms.NullBooleanSelect(
             attrs={
                 "class": "js-states form-control select_2",
                 "id": "select2",
             }
         ),
         "uses_fuel_car_sharing_services": forms.NullBooleanSelect(
             attrs={
                 "class": "js-states form-control select_2",
                 "id": "select2",
             }
         ),
         "bicycle_usage": forms.Select(
             attrs={
                 "class": "js-states form-control select_2",
                 "id": "select2",
             }
         )
     }
示例#24
0
 class Meta:
     model = Product
     fields = '__all__'
     exclude = ('oner',)
     widgets = {
         'name': forms.TextInput(attrs={'class':'form-control','style':'background: #fff;color: #202020;'}),
         'Brand': forms.TextInput(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #202020;outline: none;'}),
         'price': forms.NumberInput(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #202020;outline: none;'}),
         'Discountprice': forms.NumberInput(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #202020;outline: none;'}),
         'ISNew': forms.NullBooleanSelect(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #000;outline: none;'}),
         'ISBestseller': forms.NullBooleanSelect(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #000;outline: none;'}),
         'digital': forms.NullBooleanSelect(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #000;outline: none;'}),
         'discraption': forms.Textarea(attrs={'class':'form-control','style':'height: 206px;width: 100%;background: #fff;color: #202020;font-family: cursive;font-size: 24px;'}),
         'category': forms.Select(attrs={'class':'form-control','style':'float:right;width: 200px;background: #fff;color: #000;outline: none;'}),
         'image': forms.ClearableFileInput(attrs={'class':'form-control','style':'font-size: 0px;width: 19%;background: #888;color: #888;position: absolute;top: 48%;left: 40%;border-radius: 50%;border: #888;'}),
         'image1': forms.ClearableFileInput(attrs={'class':'form-control','style':'font-size: 0px;width: 19%;background: #888;color: #888;position: absolute;top: 49%;left: 40%;border-radius: 50%;border: #888;height: 10%;'}),
         'image2': forms.ClearableFileInput(attrs={'class':'form-control','style':'font-size: 0px;width: 19%;background: #888;color: #888;position: absolute;top: 49%;left: 40%;border-radius: 50%;border: #888;height: 10%;'}),
         'image3': forms.ClearableFileInput(attrs={'class':'form-control','style':'font-size: 0px;width: 19%;background: #888;color: #888;position: absolute;top: 49%;left: 40%;border-radius: 50%;border: #888;height: 10%;'}),
         'image4': forms.ClearableFileInput(attrs={'class':'form-control','style':'font-size: 0px;width: 19%;background: #888;color: #888;position: absolute;top: 49%;left: 40%;border-radius: 50%;border: #888;height: 10%;'}),     
     }
示例#25
0
文件: forms.py 项目: rriskin/ospc.org
    def set_form(defaults):
        """
        Setup all of the form fields and widgets with the the 2016 default data
        """
        widgets = {}
        labels = {}
        update_fields = {}
        boolean_fields = []

        for param in list(defaults.values()):
            for field in param.col_fields:
                attrs = {
                    'class': 'form-control',
                    'placeholder': field.default_value,
                }
                if param.coming_soon:
                    attrs['disabled'] = True

                if param.tc_id in boolean_fields:
                    checkbox = forms.CheckboxInput(
                        attrs=attrs, check_test=bool_like)
                    widgets[field.id] = checkbox
                    update_fields[field.id] = forms.BooleanField(
                        label=field.label,
                        widget=widgets[field.id],
                        required=False,
                        disabled=param.gray_out
                    )
                else:
                    widgets[field.id] = forms.TextInput(attrs=attrs)
                    update_fields[field.id] = forms.fields.CharField(
                        label=field.label,
                        widget=widgets[field.id],
                        required=False,
                        disabled=param.gray_out
                    )

                labels[field.id] = field.label

            if getattr(param, "inflatable", False):
                field = param.cpi_field
                attrs = {
                    'class': 'form-control sr-only',
                    'placeholder': bool(field.default_value),
                }

                widgets[field.id] = forms.NullBooleanSelect(attrs=attrs)
                update_fields[field.id] = forms.NullBooleanField(
                    label=field.label,
                    widget=widgets[field.id],
                    required=False,
                    disabled=param.gray_out
                )
        return widgets, labels, update_fields
示例#26
0
    def set_multiple_references_and_tolerances(self, request, queryset):

        testtypes = set(
            queryset.values_list('test__type', flat=True).distinct())

        # check if tests have the same type of tolerance, else return with error message
        if (len(testtypes) > 1 and 'multchoice' in testtypes
                or len(testtypes) > 1 and 'boolean' in testtypes):

            messages.error(
                request,
                "Multiple choice and/or boolean references and tolerances can't be set"
                " together with other test types")
            return HttpResponseRedirect(request.get_full_path())

        if 'apply' in request.POST:
            form = SetMultipleReferencesAndTolerancesForm(request.POST)
        else:
            form = SetMultipleReferencesAndTolerancesForm(
                initial={'contenttype': None})

        # if selected tests are NOT multiple choice or boolean, select all the tolerances which are NOT multiple choice or boolean
        if not 'boolean' in testtypes and not 'multchoice' in testtypes:
            tolerances = models.Tolerance.objects.exclude(
                type="multchoice").exclude(type="boolean")
            form.fields["tolerance"].queryset = tolerances

        # if selected tests are multiple choice select all the tolerances which are multiple choice
        elif 'multchoice' in testtypes:
            tolerances = models.Tolerance.objects.filter(type="multchoice")
            form.fields["contenttype"].initial = 'multchoice'
            form.fields["tolerance"].queryset = tolerances
            form.fields["reference"].required = False
            form.fields["reference"].widget = forms.HiddenInput()

        # if selected tests are boolean select all the tolerances which are boolean
        elif 'boolean' in testtypes:
            form.fields["contenttype"].initial = 'boolean'
            form.fields["reference"].widget = forms.NullBooleanSelect()
            form.fields["tolerance"].required = False
            form.fields["tolerance"].widget = forms.HiddenInput()

        if 'apply' in request.POST and form.is_valid():
            return self.form_valid(request, queryset, form)
        else:
            context = {
                'queryset': queryset,
                'form': form,
                'action_checkbox_name': admin.ACTION_CHECKBOX_NAME,
            }
            return render(
                request,
                'admin/qa/unittestinfo/set_multiple_refs_and_tols.html',
                context)
示例#27
0
class CreateMeetupForm(forms.ModelForm):
    name = forms.CharField(required=True)
    duration = forms.IntegerField(min_value=1, required=True)
    max_attendees = forms.IntegerField(min_value=1, required=False)
    description = forms.Textarea
    private = forms.NullBooleanSelect()

    class Meta:
        model = Meetup
        fields = [
            'name', 'duration', 'max_attendees', 'description', 'private'
        ]
示例#28
0
 class Meta:
     model = System
     # this HTML forms are shown
     fields = (
         'system_name',
         'systemstatus',
         'analysisstatus',
         'reason',
         'recommendation',
         'systemtype',
         'domain',
         'system_dnssuffix',
         'os',
         'osarch',
         'system_install_time',
         'system_lastbooted_time',
         'system_deprecated_time',
         'system_is_vm',
         'host_system',
         'company',
         'location',
         'serviceprovider',
         'contact',
         'tag',
         'case',
     )
     # special form type or option
     widgets = {
         'system_name': forms.TextInput(attrs={'autofocus': 'autofocus'}),
         'systemstatus': forms.RadioSelect(),
         'analysisstatus': forms.RadioSelect(),
         'reason': forms.RadioSelect(),
         'recommendation': forms.RadioSelect(),
         'systemtype': forms.RadioSelect(),
         'ip': forms.GenericIPAddressField(),
         'domain': forms.RadioSelect(),
         'system_dnssuffix': forms.TextInput(),
         'os': forms.RadioSelect(),
         'osarch': forms.RadioSelect(),
         'system_install_time': forms.DateTimeInput(),
         'system_lastbooted_time': forms.DateTimeInput(),
         'system_deprecated_time': forms.DateTimeInput(),
         'system_is_vm': forms.NullBooleanSelect(),
         'host_system': forms.Select(),
         'company': forms.CheckboxSelectMultiple(),
         'location': forms.RadioSelect(),
         'serviceprovider': forms.RadioSelect(),
         'contact': forms.RadioSelect(),
         'tag': forms.CheckboxSelectMultiple(),
         'case': forms.CheckboxSelectMultiple(),
     }
示例#29
0
    class Meta:
        model = TaxSaveInputs
        exclude = ['creation_date']
        widgets = {}
        labels = {}
        boolean_fields = [
            "_ID_BenefitSurtax_Switch",
            "_ID_BenefitCap_Switch",
            "_ALD_InvInc_ec_base_RyanBrady",
            "_NIIT_PT_taxed",
            "_CG_nodiff",
            "_EITC_indiv",
            "_CTC_new_refund_limited",
            "_II_no_em_nu18",
            "_ID_AmountCap_Switch",
            "_CTC_new_for_all",
            "_CTC_new_refund_limited_all_payroll",
            "_PT_wages_active_income",
            "_PT_top_stacking",
        ]

        for param in TAXCALC_DEFAULTS_2016.values():
            for field in param.col_fields:
                attrs = {
                    'class': 'form-control',
                    'placeholder': field.default_value,
                }

                if param.coming_soon:
                    attrs['disabled'] = True

                if param.tc_id in boolean_fields:
                    checkbox = forms.CheckboxInput(attrs=attrs,
                                                   check_test=bool_like)
                    widgets[field.id] = checkbox
                else:
                    widgets[field.id] = forms.TextInput(attrs=attrs)

                labels[field.id] = field.label

            if param.inflatable:
                field = param.cpi_field
                attrs = {
                    'class': 'form-control sr-only',
                    'placeholder': bool(field.default_value),
                }

                if param.coming_soon:
                    attrs['disabled'] = True

                widgets[field.id] = forms.NullBooleanSelect(attrs=attrs)
示例#30
0
    class Meta:
        model = Cementerio

        fields = [
            'trabajo_final',
        ]

        labels = {
            'trabajo_final': 'Finalizacíon de obra',
        }

        widgets = {
            'trabajo_final': forms.NullBooleanSelect(),
        }