コード例 #1
0
class UploadFileForm(forms.Form):
    title = forms.CharField(max_length=50)
    file = forms.FileField(
        widget=forms.ClearableFileInput(attrs={'multiple': True}),
        max_length=10485760)
コード例 #2
0
class UploadFileForm(forms.Form):
    file_field = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': False}))
コード例 #3
0
class AppraisalCreateForm(forms.Form):

    archivo = forms.FileField(
        required=False,
        widget=forms.ClearableFileInput(
            attrs={'class':"custom-file-input",'multiple': False}))

    url = forms.URLField(required=False)
    url.widget.attrs.update({'class': "form-control",'placeholder': 'Ingrese la URL de la solicitud'})

    tipoTasacion = forms.ChoiceField(
        label="Tipo Pedido",
        choices=Appraisal.tipoTasacion_choices)
    tipoTasacion.widget.attrs.update({'class': "form-control"})

    finalidad = forms.ChoiceField(
        label="Finalidad",
        choices=Appraisal.objective_choices)
    finalidad.widget.attrs.update({'class': "form-control"})

    visita = forms.ChoiceField(
        label="Visita",
        choices=Appraisal.visit_choices)
    visita.widget.attrs.update({'class': "form-control", 'data-validation':"required"})

    solicitante = forms.ChoiceField(
        label="Solicitante",
        choices=Appraisal.petitioner_choices)
    solicitante.widget.attrs.update({'class': "form-control"})

    solicitanteOther = forms.CharField(max_length=100, label="Otro", required=False)
    solicitanteOther.widget.attrs.update({'class': "form-control"})

    solicitanteCodigo = forms.CharField(max_length=100, label="Código", required=False)
    solicitanteCodigo.widget.attrs.update({'class': "form-control", 'data-validation':"required"})

    solicitanteSucursal = forms.CharField(max_length=100, label="Sucursal", required=False)
    solicitanteSucursal.widget.attrs.update({'class': "form-control", 'data-validation':"required"})

    solicitanteEjecutivo = forms.CharField(
        max_length=100,
        label="Ejecutivo",
        required=False)
    solicitanteEjecutivo.widget.attrs.update({'class': "form-control"})
    solicitanteEjecutivoEmail = forms.EmailField(
        max_length=100,
        label="Email",
        required=False)
    solicitanteEjecutivoEmail.widget.attrs.update({'class': "form-control"})
    solicitanteEjecutivoTelefono = forms.CharField(
        max_length=20,
        label="Teléfono",
        required=False)
    solicitanteEjecutivoTelefono.widget.attrs.update({'class': "form-control"})

    cliente = forms.CharField(label="Nombre cliente", max_length=100, required=False)
    cliente.widget.attrs.update({'class': "form-control"})
    clienteRut = forms.CharField(label="Rut cliente", max_length=100, required=False)
    clienteRut.widget.attrs.update({'class': "form-control"})
    clienteEmail = forms.EmailField(label="Email cliente", max_length=100, required=False)
    clienteEmail.widget.attrs.update({'class': "form-control"})
    clienteTelefono = forms.CharField(label="Teléfono cliente", max_length=100, required=False)
    clienteTelefono.widget.attrs.update({'class': "form-control"})

    propietario = forms.CharField(label="Nombre propietario", max_length=100, required=False)
    propietario.widget.attrs.update({'class': "form-control"})
    propietarioRut = forms.CharField(label="Rut propietario", max_length=100, required=False)
    propietarioRut.widget.attrs.update({'class': "form-control"})
    propietarioEmail = forms.EmailField(label="Email propietario", max_length=100, required=False)
    propietarioEmail.widget.attrs.update({'class': "form-control"})
    propietarioTelefono = forms.CharField(label="Teléfono propietario", max_length=100, required=False)
    propietarioTelefono.widget.attrs.update({'class': "form-control"})

    contacto = forms.CharField(label="Nombre contacto", max_length=100, required=False)
    contacto.widget.attrs.update({'class': "form-control"})
    contactoRut = forms.CharField(label="Rut contacto", max_length=100, required=False)
    contactoRut.widget.attrs.update({'class': "form-control"})
    contactoEmail = forms.EmailField(label="Email contacto", max_length=100, required=False)
    contactoEmail.widget.attrs.update({'class': "form-control"})
    contactoTelefono = forms.CharField(label="Teléfono contacto", max_length=100, required=False)
    contactoTelefono.widget.attrs.update({'class': "form-control"})

    propertyType = forms.ChoiceField(
        label="Tipo propiedad",
        choices=Building.propertyType_choices)
    propertyType.widget.attrs.update({'class':"form-control"})

    rol = forms.CharField(label="Rol", max_length=20, required=False)
    rol.widget.attrs.update({'class': "form-control"})

    addressRegion = forms.ModelChoiceField(
        label="Región",
        queryset=Region.objects.only('name').all())
    addressRegion.widget.attrs.update({'class':"form-control"})

    # We need all possible communes to be there initially, so that when we validate the form,
    # it finds the choice.
    addressCommune = forms.ModelChoiceField(
        label="Comuna",
        queryset=Commune.objects.only('name').all())
    addressCommune.widget.attrs.update({'class':"form-control"})

    addressStreet = forms.CharField(
        max_length=200,
        label="Calle")
    addressStreet.widget.attrs.update({'class':"form-control",'data-validation':"required"})

    addressNumber = forms.CharField(max_length=30,label="Número / Km")
    addressNumber.widget.attrs.update({'class':"form-control",'data-validation':"required"})

    addressNumber3 = forms.CharField(max_length=30,label="Casa / Edificio / Block",required=False)
    addressNumber3.widget.attrs.update({'class':"form-control"})

    addressNumber2 = forms.CharField(max_length=30,label="Depto.",required=False)
    addressNumber2.widget.attrs.update({'class':"form-control"})

    addressLoteo = forms.CharField(max_length=100,label="Loteo",required=False)
    addressLoteo.widget.attrs.update({'class':"form-control"})

    addressSitio = forms.CharField(max_length=100,label="Lote / Sitio",required=False)
    addressSitio.widget.attrs.update({'class':"form-control"})

    addressSquare = forms.IntegerField(label="Manzana",required=False)
    addressSquare.widget.attrs.update({'class':"form-control"})
    
    appraisalTimeRequest = forms.DateTimeField(label="Fecha solicitud")
    appraisalTimeRequest.widget = DateTimePickerInput(options={
                     "format": "DD/MM/YYYY HH:MM",
                     "showClose": True,
                     "showClear": True,
                     "showTodayButton": True
                 })
    
    appraisalTimeDue = forms.DateTimeField(label="Fin de plazo")
    appraisalTimeDue.widget = DateTimePickerInput(options={
                     "format": "DD/MM/YYYY HH:MM",
                     "showClose": True,
                     "showClear": True,
                     "showTodayButton": True
                 })
    
    appraisalPrice = forms.FloatField(label="Precio",required=False)
    appraisalPrice.widget.attrs.update({'class': "form-control"})

    comments = forms.CharField(max_length=1000,label="Comentarios adicionales",required=False,widget=forms.Textarea)
    comments.widget.attrs.update({'class':"form-control",'rows':3})

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        #self.fields['addressCommune'].queryset = []

    def clean_appraisalTimeFrame(self):
        data = self.cleaned_data['appraisalTimeFrame']
        # Check date is not in past.
        if data.replace(tzinfo=None) < datetime.datetime.now().replace(tzinfo=None):
            raise forms.ValidationError(('Plazo se debe fijar en el futuro'), code='invalid')
        # Remember to always return the cleaned data.
        return data
コード例 #4
0
ファイル: forms.py プロジェクト: proysistem/mundosportec
    class Meta:
        model = Existencia
        fields = [
            "exs_sucursa",
            "exs_iddivis",
            "exs_idmarca",
            "exs_idmodel",
            "exs_idcolor",
            # 'exs_product':
            # 'exs_detalle',
            # 'exs_abrevia',
            'exs_tpoprod',
            'exs_idunida',
            # 'exs_tabtall',
            'exs_saldinc',
            'exs_ingreso',
            'exs_egresos',
            'exs_saldact',
            'exs_comprom',
            'exs_xconfir',
            'exs_dsponib',
            'exs_feching',
            'exs_fechegr',
            'exs_fechinv',
            'exs_costant',
            'exs_dispant',
            'exs_costact',
            'exs_cosprom',
            'exs_distrib',
            'exs_mayoris',
            'exs_detalls',
            'exs_publico',
            'exs_special',
            'exs_imgprod',
            'exs_statreg',
        ]

        labels = {
            "exs_sucursa": 'Sucursal',
            "exs_iddivis": 'Línea de productos',
            "exs_idmarca": 'Marca',
            "exs_idmodel": 'Modelo',
            "exs_idcolor": 'Color',
            # 'exs_product':   'Cód. Producto',
            # 'exs_detalle':   'Detalle',
            # 'exs_abrevia':   'Abreviatura',
            'exs_tpoprod': 'Tipo de producto',
            'exs_idunida': 'Unid. De medida',
            # 'exs_tabtall':   'Tab./Tallas ',
            'exs_saldinc': 'Saldo.inicial',
            'exs_ingreso': 'Ingresos',
            'exs_egresos': 'Egresos',
            'exs_saldact': 'Saldo.Actual',
            'exs_comprom': 'S.Comprometido',
            'exs_xconfir': 'Sldo.x/confirmar',
            'exs_dsponib': 'Saldo.disponible',
            'exs_feching': 'Fecha/últ.Ingreso',
            'exs_fechegr': 'Fecha/últ.Egreso',
            'exs_fechinv': 'Fecha de inventario',
            'exs_costant': 'Costo.promedio.Anterior',
            'exs_dispant': 'Disponible.Anterior',
            'exs_costact': 'Costo Actual',
            'exs_cosprom': 'Cost.promed.Actual',
            'exs_distrib': 'Precio:Distribuidos',
            'exs_mayoris': 'Precio:Mayorista',
            'exs_detalls': 'Precio:Detallista',
            'exs_publico': 'Precio:Publico',
            'exs_special': 'Precio:Especial',
            'exs_imgprod': 'Imagen del producto',
            'exs_statreg': 'Status del reg.',
        }
        widgets = {
            "tex_ingre01":
            forms.NumberInput(attrs={"disabled": "disabled"}),
            "exs_sucursa":
            forms.Select(),
            "exs_iddivis":
            forms.Select(),
            "exs_idmarca":
            forms.Select(),
            "exs_idmodel":
            forms.Select(),
            "exs_idcolor":
            forms.Select(),
            # 'exs_product':   'Cód. Producto',
            # 'exs_detalle':  forms.TextInput(),
            # 'exs_abrevia':  forms.TextInput(),
            'exs_tpoprod':
            forms.Select(),
            'exs_idunida':
            forms.Select(),
            # 'exs_tabtall':  forms.TextInput(),
            'exs_saldinc':
            forms.NumberInput(attrs={
                "disabled": "disabled",
                "step": "0.01"
            }),
            'exs_ingreso':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_egresos':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_saldact':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_comprom':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_xconfir':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_dsponib':
            forms.NumberInput(attrs={"disabled": "disabled"}),
            'exs_feching':
            forms.DateInput(attrs={"disabled": "disabled"}),
            'exs_fechegr':
            forms.DateInput(attrs={"disabled": "disabled"}),
            'exs_fechinv':
            forms.DateInput(attrs={"disabled": "disabled"}),
            'exs_costant':
            forms.NumberInput(),
            'exs_dispant':
            forms.NumberInput(),
            'exs_costact':
            forms.NumberInput(),
            'exs_cosprom':
            forms.NumberInput(),
            'exs_distrib':
            forms.NumberInput(),
            'exs_mayoris':
            forms.NumberInput(),
            'exs_detalls':
            forms.NumberInput(),
            'exs_publico':
            forms.NumberInput(),
            'exs_special':
            forms.NumberInput(),
            'exs_imgprod':
            forms.ClearableFileInput(),
            # 'exs_statreg':  forms.BoleanInput(),
        }
コード例 #5
0
class ImportTestsFromFilesForm(forms.Form):
    tests_files = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
コード例 #6
0
class UploadForm(forms.Form):
    """Main app form: upload one or more files"""
    files = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}))
コード例 #7
0
ファイル: forms.py プロジェクト: BikashJhendi/easyrooms
class RoomImagesForm(RoomForms):
    rooms_images = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))

    class Meta(RoomForms.Meta):
        fields = RoomForms.Meta.fields + ('rooms_images', )
コード例 #8
0
class SupplierIntakeForm(forms.ModelForm):

    supervisor_name = forms.ModelChoiceField(
        label="Supervisor Name",
        queryset=Employee.objects.all().filter(is_supervisor=True),
        widget=forms.Select(attrs={'class': 'form-control'}))

    supplier_name = forms.ModelChoiceField(
        label="Supplier Name",
        queryset=Supplier.objects.all().filter(),
        widget=forms.Select(attrs={'class': 'form-control'}))

    total_box_count = forms.FloatField(
        label="Number of Boxes",
        widget=forms.NumberInput(attrs={'class': 'form-control'}),
        min_value=0)

    passed_float_box_count = forms.FloatField(
        label="Number of Passed Float Boxes",
        required=False,
        widget=forms.NumberInput(attrs={'class': 'form-control'}),
        min_value=0)

    is_floated = forms.BooleanField(
        label="Floated?",
        required=False,
        widget=forms.CheckboxInput(attrs={
            'class': 'form-check-input',
            'id': "is_floated"
        }))

    proof_file = forms.FileField(
        label="Pictures of Batch",
        widget=forms.ClearableFileInput(attrs={
            'multiple': True,
            'class': 'form-control'
        }))

    supervisor_signature = JSignatureField(label="Supervisor Signature")

    representative_name = forms.CharField(
        label="Seller Rep. Name",
        widget=forms.TextInput(attrs={'class': 'form-control'}))

    representative_signature = JSignatureField(label="Seller Rep. Signature ")

    def clean(self):
        cleaned_data = super().clean()
        total_box_count = cleaned_data.get("total_box_count")
        passed_float_box_count = cleaned_data.get("passed_float_box_count")

        if total_box_count and passed_float_box_count:
            # Only do something if both fields are valid so far.
            if passed_float_box_count > total_box_count:
                msg = "Passed float count can not be more than total box count"
                self.add_error('passed_float_box_count', msg)

    class Meta:
        model = Intake
        fields = [
            "supervisor_name", "supplier_name", "total_box_count",
            "passed_float_box_count", "is_floated", "proof_file",
            "supervisor_signature", "representative_name",
            "representative_signature"
        ]
コード例 #9
0
ファイル: forms.py プロジェクト: hypercoder457/NewsApp
 class Meta:
     model = Article
     fields = ['title', 'description', 'content', 'image', 'issues']
     widgets = {'title': forms.Textarea(
         attrs={'cols': 80}), 'description': forms.Textarea(attrs={'cols': 80}),
         'content': forms.Textarea(attrs={'cols': 80}), 'image': forms.ClearableFileInput()}
コード例 #10
0
class FileFieldForm(forms.Form):
    images = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
コード例 #11
0
class DocumentForm(forms.Form):
    docfile = forms.FileField(
        label='Select file',
        widget=forms.ClearableFileInput(attrs={'multiple': True}))
コード例 #12
0
ファイル: forms.py プロジェクト: dead-pirate/Digital-Liberty
    class Meta:
        model = Profile
        fields = [
            'bio',
            'gender',
            'disp_pic',
            'profession',
            'fb',
            'git_hub',
            'insta',
            'twitter',
            'pinterest',
            'linked_in',
            'ex_link',
        ]

        widgets = {
            'bio':
            forms.Textarea(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'Tell something About Yourself'
                }),
            'gender':
            forms.Select(
                attrs={
                    'class':
                    'form-control custom-select bg-white border-left-0 border-md',
                }),
            'disp_pic':
            forms.ClearableFileInput(attrs={
                # 'class': 'custom-file-input',
            }),
            'profession':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'Blogger,Programmer,Artist etc.'
                }),
            'fb':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_fb_link_here.com'
                }),
            'git_hub':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_git_link_here.com'
                }),
            'insta':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_insta_link_here.com'
                }),
            'twitter':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_twitter_link_here.com'
                }),
            'pinterest':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_pin_here.com'
                }),
            'linked_in':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_linkedin_here.com'
                }),
            'ex_link':
            forms.TextInput(
                attrs={
                    'class': 'form-control bg-white border-left-0 border-md',
                    'placeholder': 'http://your_link_here.com'
                }),
        }
コード例 #13
0
class UploadProfilePicFileForm(forms.Form):
	title = forms.CharField(max_length=50)
	image = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': False}))
コード例 #14
0
class ClassPhotoForm(forms.Form):
	#course = forms.CharField(max_length=50)
	#date = forms.DateField(initial=datetime.date.today)
	image = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}))
コード例 #15
0
 class Meta:
     model = GaleriaImagen
     fields = ['file', ]
     widgets = {
         'file': forms.ClearableFileInput(attrs={'multiple': 'true'})
     }
コード例 #16
0
ファイル: forms.py プロジェクト: SIMRAN1/BytePad
class UploadForm(forms.Form):
    file = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
    exam = forms.ModelChoiceField(queryset=Exam.objects.all())
    session = forms.ModelChoiceField(queryset=Session.objects.all())
コード例 #17
0
ファイル: forms.py プロジェクト: Mostaard/mavan
class AlbumForm(forms.Form):
    album_name = forms.CharField(label='Titel', max_length=100, required=True)
    album_description = forms.CharField(label='Beschrijving',
                                        widget=forms.Textarea)
    images = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
コード例 #18
0
class FileForm(forms.Form):
    f = forms.FileField(widget=forms.ClearableFileInput())
コード例 #19
0
class RationalCreateForm(forms.Form):
    """Форма RationalModel, с виджетом ckeditor"""
    rational_structure_from = forms.CharField(
        label='',
        widget=forms.TextInput(
            attrs={
                'type': "text",
                'name': 'rational_structure_from',
                'placeholder': 'имя подразделения',
                'class': 'form-control'
            }),
        required=False)
    rational_uid_registrated = forms.IntegerField(
        label='номер регистрации',
        widget=forms.NumberInput(
            attrs={
                'type': 'number',
                'name': 'rational_uid_registrated',
                'value': '0',
                'placeholder': '0',
                'class': 'form-control'
            }),
        required=False)
    rational_date_registrated = forms.DateTimeField(
        label='дата регистрации',
        widget=forms.DateTimeInput(
            attrs={
                'type': "datetime-local",
                'name': 'rational_date_registrated',
                'class': 'form-control',
                'required': ''
            }),
        required=False)
    rational_name = forms.CharField(label='',
                                    widget=forms.TextInput(
                                        attrs={
                                            'type': "text",
                                            'name': 'rational_name',
                                            'placeholder': 'название статьи',
                                            'class': 'form-control',
                                            'required': ''
                                        }),
                                    required=True)
    rational_place_innovation = forms.CharField(
        label='',
        widget=forms.TextInput(
            attrs={
                'type': "text",
                'name': 'rational_place_innovation',
                'placeholder': 'место внедрения',
                'class': 'form-control'
            }),
        required=False)
    rational_description = forms.CharField(label="описание",
                                           widget=CKEditorUploadingWidget(),
                                           required=False)
    rational_addition_file_1 = forms.FileField(
        label="приложение 1",
        widget=forms.ClearableFileInput(
            attrs={
                'type': "file",
                'name': 'rational_addition_file_1',
                'class': 'form-control'
            }),
        required=False,
        allow_empty_file=True)
    rational_addition_file_2 = forms.FileField(
        label="приложение 2",
        widget=forms.ClearableFileInput(
            attrs={
                'type': "file",
                'name': 'rational_addition_file_2',
                'class': 'form-control'
            }),
        required=False,
        allow_empty_file=True)
    rational_addition_file_3 = forms.FileField(
        label="приложение 3",
        widget=forms.ClearableFileInput(
            attrs={
                'type': "file",
                'name': 'rational_addition_file_3',
                'class': 'form-control'
            }),
        required=False,
        allow_empty_file=True)
    rational_offering_members_button = forms.CharField(
        label="",
        required=False,
        widget=forms.TimeInput(
            attrs={
                'class':
                'btn btn-warning w-50',
                'type':
                'button',
                'id':
                'rational_offering_members_button',
                'name':
                'rational_offering_members_button',
                'title':
                'Вставьте в "Источник"',
                'placeholder':
                '<table align="left" border="2" cellpadding="2" cellspacing="2" style="width:1000px"><thead><tr><td><p>Фамилия, имя, отчество авторов</p></td><td><p>Место работы</p></td><td><p>Должность</p></td><td><p>Доля (%) участия*</p></td><td><p>Год рождения</p></td><td><p>Подпись**</p></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>'
            }))
    rational_offering_members = forms.CharField(
        label="предложившие участники",
        widget=CKEditorUploadingWidget(),
        required=False)
    rational_conclusion_button = forms.CharField(
        label="",
        required=False,
        widget=forms.TimeInput(
            attrs={
                'class':
                'btn btn-warning w-50',
                'type':
                'button',
                'id':
                'rational_conclusion_button',
                'name':
                'rational_conclusion_button',
                'title':
                'Вставьте в "Источник"',
                'placeholder':
                '<table align="left" border="2" cellpadding="2" cellspacing="2" style="width:1000px"><thead><tr><td><p>Название Структурного подразделения</p></td><td><p>Заключение</p></td><td><p>Должность, название отдела</p></td><td><p>Подпись</p></td></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>'
            }))
    rational_conclusion = forms.CharField(label="заключения по предложению",
                                          widget=CKEditorUploadingWidget(),
                                          required=False)
    rational_change_documentations_button = forms.CharField(
        label="",
        required=False,
        widget=forms.TimeInput(
            attrs={
                'class':
                'btn btn-warning w-50',
                'type':
                'button',
                'id':
                'rational_change_documentations_button',
                'name':
                'rational_change_documentations_button',
                'title':
                'Вставьте в "Источник"',
                'placeholder':
                '<table align="left" border="2" cellpadding="2" cellspacing="2" style="width:1000px"><thead><tr><td><p>Наименование документа</p></td><td><p>№ извещения</p></td><td><p>Дата изменения</p></td><td><p>Должность и название отдела</p></td><td><p>Подпись</p></td></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>'
            }))
    rational_change_documentations = forms.CharField(
        label="изменение нормативной и тех. документации",
        widget=CKEditorUploadingWidget(),
        required=False)
    rational_resolution = forms.CharField(
        label='',
        widget=forms.TextInput(
            attrs={
                'type': "text",
                'name': 'rational_resolution',
                'placeholder': 'принятое решение',
                'class': 'form-control'
            }),
        required=False)
    rational_responsible_members_button = forms.CharField(
        label="",
        required=False,
        widget=forms.TimeInput(
            attrs={
                'class':
                'btn btn-warning w-50',
                'type':
                'button',
                'id':
                'rational_responsible_members_button',
                'name':
                'rational_responsible_members_button',
                'title':
                'Вставьте в "Источник"',
                'placeholder':
                '<table align="left" border="2" cellpadding="2" cellspacing="2" style="width:1000px"><thead><tr><td><p>ФИО сотрудника</p></td><td><p>Задачи, мероприятия</p></td><td><p>Сроки выполнения</p></td><td><p>Название подразделения, должность</p></td><td><p>Подпись ответственного сотрудника или его руководителя</p></td><td><p>Отметка о выполнении</p></thead><tbody><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>'
            }))
    rational_responsible_members = forms.CharField(
        label="ответственные участники",
        widget=CKEditorUploadingWidget(),
        required=False)
    rational_date_certification = forms.DateTimeField(
        label='дата получения удостоверения на предложение',
        widget=forms.DateTimeInput(
            attrs={
                'type': "datetime-local",
                'name': 'rational_date_create',
                'class': 'form-control',
                'required': ''
            }),
        required=False)
    rational_category = forms.ModelChoiceField(
        label="категория",
        widget=forms.Select(
            attrs={
                'class': 'form-select form-select-lg mb-3',
                'aria-label': '.form-select-lg example',
                'required': ''
            }),
        queryset=CategoryRationalModel.objects.order_by('-id'),
        empty_label="не выбрано",
        to_field_name=None,
        required=False)
    # rational_autor_name                     = forms.ModelChoiceField(label="имя автора", widget=forms.Select(), queryset=User.objects.get(id=request.user.id), empty_label="не выбрано",  to_field_name=None, required=False)
    # rational_date_create                    = forms.DateTimeField(label='дата создания', widget=forms.DateTimeInput(attrs={'type':"datetime-local",'name':'rational_date_create', 'class':'form-control'}), required=False)
    rational_addition_image = forms.ImageField(
        label="картинка к предложению",
        widget=forms.ClearableFileInput(
            attrs={
                'type': "file",
                'name': 'rational_addition_image',
                'class': 'form-control'
            }),
        required=False)

    # rational_status                         = forms.BooleanField(label='статус', widget=forms.CheckboxInput(attrs={'type':'checkbox','name':'rational_status', 'value':'False', 'class':'form-check form-check-input'}), required=False)

    class Meta:
        model = RationalModel
        fields = '__all__'
コード例 #20
0
class IndexForm(forms.Form):
    f = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
    mal = forms.BooleanField(label='Malicious', required=False, initial=False)
コード例 #21
0
class chaform(forms.Form):
    Challan_forms = forms.FileField(required=False,widget=forms.ClearableFileInput(attrs={'multiple': True}))
コード例 #22
0
ファイル: forms.py プロジェクト: monikafg/uvmadmin
    class Meta:
        model = Materia
        fields = '__all__'

        widgets = {
            'tipo_materia':
            forms.Select(attrs={'class': 'form-control mb-2'}),
            'edicion':
            forms.Select(attrs={'class': 'form-control mb-2'}),
            'codigo':
            forms.TextInput(
                attrs={
                    'class': 'form-control input-lg mb-2',
                    'placeholder': 'Código...',
                    'required': True
                }),
            'denominacion':
            forms.TextInput(
                attrs={
                    'class': 'form-control input-lg mb-2',
                    'placeholder': 'Denominación...',
                    'required': True
                }),
            # Solo en edición
            'ponente':
            forms.SelectMultiple(attrs={'class': 'form-control mb-2'}),
            'descuento':
            forms.SelectMultiple(attrs={'class': 'form-control mb-2'}),
            'lugar':
            forms.TextInput(
                attrs={
                    'class': 'form-control input-lg mb-2',
                    'placeholder': 'Lugar de Celebración...',
                    'required': True
                }),
            'descripcion':
            forms.Textarea(attrs={
                'class': 'form-control input-lg mb-2',
                'required': True
            }),
            'imagen':
            forms.ClearableFileInput(
                attrs={'class': 'form-control-file mb-2'}),
            'finicio':
            forms.TextInput(attrs={
                'class': 'form-control mb-2',
                'type': 'date',
            }),
            'hinicio':
            forms.TextInput(attrs={
                'class': 'form-control mb-2',
                'type': 'time',
            }),
            'ffin':
            forms.TextInput(attrs={
                'class': 'form-control mb-2',
                'type': 'date',
            }),
            'hfin':
            forms.TextInput(attrs={
                'class': 'form-control mb-2',
                'type': 'time',
            }),
            'programa':
            forms.ClearableFileInput(
                attrs={'class': 'form-control-file mb-2'}),
            'dirigido':
            forms.TextInput(
                attrs={
                    'class': 'form-control input-lg mb-2',
                    'placeholder': 'Dirigido a...'
                }),
            'creditos':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'step': 0.25,
                'min': 0,
                'default': 0
            }),
            'horas':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'min': 0,
                'default': 0
            }),
            'importe':
            forms.NumberInput(
                attrs={
                    'class': 'form-control mb-2',
                    'min': 0,
                    'max': 100.00,
                    'default': 0
                }),
            # No sé si se calcula a parte
            'importe_reducido':
            forms.NumberInput(
                attrs={
                    'class': 'form-control mb-2',
                    'min': 0,
                    'max': 100.00,
                    'default': 0
                }),
            'plazas':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'min': 0,
                'default': 0
            }),
            'aplica_dto':
            forms.Select(attrs={'class': 'form-control'},
                         choices=((False, 'No'), (True, 'Si'))),
            'plazas':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'min': 0,
                'default': 0
            }),
            'plazas_dto':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'min': 0,
                'default': 0
            }),
            'plazas_dto_ocupadas':
            forms.NumberInput(attrs={
                'class': 'form-control mb-2',
                'min': 0,
                'default': 0
            }),
            'otracuenta':
            forms.Select(attrs={'class': 'form-control'},
                         choices=((False, 'No'), (True, 'Si'))),
            'cuenta':
            forms.TextInput(attrs={
                'class': 'form-control input-lg mb-2',
                'placeholder': 'Cuenta...'
            }),
            'activo':
            forms.Select(attrs={
                'class': 'form-control',
                'default': False
            },
                         choices=((False, 'No Activo'), (True, 'Activo'))),
            'user':
            forms.NumberInput(attrs={'class': 'form-control input-lg mb-2'}),
        }
        labels = {
            'denominacion': '',
            'lugar': '',
            'descripcion': '',
            'imagen': 'Imágen',
            'inicio': 'Inicio',
            'programa': 'Programa',
            'otracuenta': 'Otra Cuenta',
            'cuenta': 'Cuenta'
        }
コード例 #23
0
class GpxUploadForm(forms.Form):
    file_field = forms.FileField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
コード例 #24
0
class VendorForm(forms.ModelForm):
    name = forms.CharField(
        label="Company Name",
        widget=forms.TextInput(attrs={
            'id': "cnameVendor",
            'maxlength': '30',
            'placeholder': 'Company Name'
        }))
    owner_fname = forms.CharField(
        label="First Name",
        widget=forms.TextInput(attrs={
            'id': "fnameVendor",
            'maxlength': '30',
            'placeholder': 'First Name'
        }))
    owner_lname = forms.CharField(
        label="Last Name",
        widget=forms.TextInput(attrs={
            'id': "lnameVendor",
            'maxlength': '30',
            'placeholder': 'Last Name'
        }))
    username = forms.CharField(widget=forms.TextInput(
        attrs={
            'id': "usernameVendor",
            'maxlength': '30',
            'placeholder': 'Username'
        }))
    password = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'id': "passwordVendor",
            'maxlength': '30',
            'placeholder': 'Password'
        }))
    mobile = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'id': "mobVendor",
            'max': '9999999999',
            'placeholder': 'Mobile Number'
        }))
    email = forms.EmailField(widget=forms.TextInput(
        attrs={
            'id': "emailVendor",
            'maxlength': '50',
            'placeholder': 'Email Address'
        }))
    business_address = forms.CharField(
        label="Address",
        widget=forms.TextInput(
            attrs={
                'id': "bAddVendor",
                'maxlength': '100',
                'placeholder': 'Business Address'
            }))
    city = forms.CharField(widget=forms.TextInput(
        attrs={
            'id': "cityVendor",
            'maxlength': '30',
            'placeholder': 'City'
        }))
    pincode = forms.IntegerField(widget=forms.NumberInput(
        attrs={
            'id': "pincodeVendor",
            'max': '999999',
            'placeholder': 'Pincode'
        }))
    state = forms.ChoiceField(label="State", choices=stateChoice)
    zone = forms.CharField(widget=forms.TextInput(
        attrs={
            'id': "zoneVendor",
            'maxlength': '30',
            'placeholder': 'Zone'
        }))
    gst_no = forms.CharField(
        label="GST Number",
        widget=forms.TextInput(attrs={
            'id': "gstVendor",
            'maxlength': '15',
            'placeholder': 'GST Number'
        }))
    aadhar_no = forms.IntegerField(label="Aadhar Number",
                                   widget=forms.NumberInput(
                                       attrs={
                                           'id': "aadharVendor",
                                           'max': '999999999999',
                                           'placeholder': 'Aadhar Number'
                                       }))
    tradelicense_id = forms.IntegerField(
        label="Trade License Number",
        widget=forms.NumberInput(
            attrs={
                'id': "tradelicenseVendor",
                'max': '99999999999999',
                'placeholder': 'Trade License ID'
            }))
    permit_document = forms.FileField(
        label="Documents for Permission",
        widget=forms.ClearableFileInput(attrs={
            'id': 'v_doc',
            'class': 'DocUpload'
        }))
    address_proof = forms.FileField(
        label="Address Proof",
        widget=forms.ClearableFileInput(attrs={
            'id': 'v_add',
            'class': 'DocUpload'
        }))
    request_status = forms.CharField(widget=forms.HiddenInput(
        attrs={'value': 'False'}))

    class Meta:
        model = Vendor
        fields = '__all__'

    """def __init__(self, *args, **kwargs):
コード例 #25
0
class ContactForm(forms.Form):
    from_email = forms.EmailField(required=True)
    subject = forms.CharField(required=True)
    attach= forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}))
    message = forms.CharField(widget=forms.Textarea, required=True)
コード例 #26
0
class FileFieldForm(forms.Form):
    file_field1 = forms.ImageField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
    file_field2 = forms.ImageField(widget=forms.ClearableFileInput(
        attrs={'multiple': True}))
コード例 #27
0
class AdvancedFileForm(forms.Form):
    file_field = forms.FileField(widget=forms.FileInput(attrs={"class": "my-custom-class"}))
    clearable_file = forms.FileField(
        widget=forms.ClearableFileInput(attrs={"class": "my-custom-class"}), required=False, initial=FakeFieldFile()
    )
コード例 #28
0
 class Meta:
     model = Documento
     fields = ['file',]
     widgets = {
         'file': forms.ClearableFileInput(attrs={'multiple': 'true'})
     }
コード例 #29
0
class AddListingForm(ModelForm):
    FACILITY_STATUS_CHOICES = (
        ('0', 'No'),
        ('1', 'Yes'),
    )

    images = forms.FileField(
        widget=forms.ClearableFileInput(attrs={
            'multiple': True,
            'id': 'gallery-photo-add'
        }),
        label='Images For Listing  ')
    facility_name = forms.CharField(
        widget=forms.TextInput(attrs={'placeholder': 'Facility Name'}),
        required=True)
    facility_status_choice = forms.ChoiceField(choices=FACILITY_STATUS_CHOICES,
                                               label="",
                                               initial='',
                                               widget=forms.Select(),
                                               required=True)

    class Meta:
        model = Listing
        exclude = ['owner', 'active', 'slug']
        widgets = {
            'title':
            forms.TextInput(attrs={'placeholder': 'Title'}),
            'price':
            forms.TextInput(attrs={'placeholder': 'Price'}),
            'area':
            forms.TextInput(attrs={'placeholder': 'Area/Location'}),
            'city':
            forms.TextInput(attrs={'placeholder': 'City'}),
            'zip_code':
            forms.TextInput(attrs={'placeholder': 'Zip Code'}),
            'tags':
            forms.TextInput(attrs={
                'data-role': 'tagsinput',
                'class': 'w-100'
            }),
            'start_time':
            DateInput(),
            'end_time':
            DateInput()
        }

    def clean_images(self):
        images = self.files.getlist('images')
        if len(images) > 5:
            raise forms.ValidationError(
                "You Can Not Upload More Than 4 Images")
        return images

    def clean_city(self):
        return self.cleaned_data.get('city').title()

    def clean_area(self):
        return self.cleaned_data.get('area').title()

    def __init__(self, *args, **kwargs):
        # call the parent init
        super(AddListingForm, self).__init__(*args, **kwargs)
        # change the widget to use checkboxes
        self.fields['category'] = forms.ModelChoiceField(
            queryset=Category.objects.all())

        self.fields['facility_name'].label = ''
コード例 #30
0
class ProfileCreationForm(forms.ModelForm):
    """
    A form that creates a user, with no privileges, from the given username and
    password.
    """
    from django.forms.utils import ErrorList

    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
                 initial=None, error_class=ErrorList, label_suffix=None,
                 empty_permitted=False, instance=None):

        if label_suffix is None:
            label_suffix = ' <->'
        super(ProfileCreationForm, self).__init__(data, files, auto_id, prefix, initial,
                                                  error_class, label_suffix, empty_permitted, instance)

    # date_of_birth = forms.CharField(label=_("Дата народження"), required=False,
    #                                 widget=forms.DateInput(attrs={'class': 'form-control',
    #                                                               'placeholder': _('дата народження')}))
    date_of_birth = forms.CharField(label=_("Дата народження"), required=False,
                                    widget=CalendarWidget(attrs={'class': 'form-control',
                                                                 'placeholder': _('дата народження')}))

    password1 = forms.CharField(label=_("Password"),
                                widget=forms.PasswordInput(attrs={'class': 'form-control',
                                                                  'placeholder': _('введіть пароль')},
                                                           render_value=True))
    password2 = forms.CharField(label=_("Password confirmation"),
                                widget=forms.PasswordInput(attrs={'class': 'form-control',
                                                                  'placeholder': _('повторіть пароль')}))
    # sex = forms.CharField(label=_("Стать"), max_length=20,
    #                       widget=forms.Select(choices=(('Man', _('Чоловік')), ('Woman', _('Жінка'))),
    #                                           attrs={'class': 'form-control', 'id': 'select'}))
    sex = forms.ChoiceField(label=_("Стать"), choices=(('Man', _('Чоловік')), ('Woman', _('Жінка'))),
                            widget=forms.RadioSelect(attrs={'id': 'select'}))
    avatar = forms.ImageField(label=_("Аватарка"), widget=forms.ClearableFileInput(attrs={'class': "btn btn-default"}),
                              required=False)

    class Meta:
        model = User
        fields = ['username', 'first_name', 'last_name', 'email']
        widgets = {'username': forms.TextInput(attrs={'class': 'form-control', 'rows': 4,
                                                      'placeholder': _('логін')}),
                   'first_name': forms.TextInput(attrs={'class': 'form-control', 'rows': 4,
                                                        'placeholder': _("ім'я")}),
                   'last_name': forms.TextInput(attrs={'class': 'form-control', 'rows': 4,
                                                       'placeholder': _("прізвище")}),
                   'email': forms.EmailInput(attrs={'class': 'form-control', 'rows': 4, 'id': 'email',
                                                    'placeholder': _("e-mail")},)}

        labels = {'username': _("Логін"),
                  'first_name': _("Ім'я"),
                  'last_name': _("Прізвище"),
                  'email': _("E-mail")}

        error_messages = {
            'username': {
                'required': _('Будь-ласка, введіть логін')},
            'email': {
                'required': _('Будь-ласка, введіть E-mail')}
        }

        help_texts = {'username': None}

    def clean_password1(self):
        password1 = self.cleaned_data.get("password1")
        valid_password = validate_password(password1)
        if valid_password is not None:
            raise valid_password.ValidationError()
        return password1

    def clean_password2(self):
        password1 = self.cleaned_data.get("password1")
        password2 = self.cleaned_data.get("password2")
        if password1 and password2 and password1 != password2:
            raise forms.ValidationError(
                _("Паролі не співпадають!"),
                code='password_mismatch',
                )
        return password2

    def clean_email(self):
        email = self.cleaned_data.get("email")
        username = self.cleaned_data.get("username", None)
        exists_user = User.objects.filter(username=username).exists()
        email_exists = User.objects.filter(email=email).exists()
        if username is not None and exists_user:
            user = User.objects.get(username=username)
            if email == user.email:
                return email
        if not email:
            raise forms.ValidationError(_("Це поле обов'язкове."), code='require')
        elif email_exists:
            raise forms.ValidationError(_("Такий email вже зареєстрований.", code='email_exists'))
        else:
            return email

    def clean_avatar(self):
        avatar = self.cleaned_data.get("avatar")
        sex = self.cleaned_data.get("sex")
        if not avatar and sex == 'Man':
            avatar = '/static/loginsys/img/unknow_user_man.jpg'
            return avatar
        elif not avatar and sex == 'Woman':
            avatar = '/static/loginsys/img/unknow_user_woman.jpg'
        return avatar

    def save(self, commit=True):
        user = super(ProfileCreationForm, self).save(commit=False)
        user.set_password(self.cleaned_data["password1"])
        if commit:
            user.save()
        return user