예제 #1
0
class ProgramEntranceTaskForm(EntranceTaskForm):
    task_type = 'program'

    language = forms.ModelChoiceField(
        queryset=modules.ejudge.models.ProgrammingLanguage.objects.all(),
        to_field_name='id',
        required=True,
        empty_label='Язык программирования',
        label='Язык программирования',
        label_suffix='')

    solution = frontend.forms.RestrictedFileField(
        max_upload_size=64 * 1024,
        required=True,
        label='Выберите файл с программой',
        label_suffix='',
        widget=widgets.ClearableFileInput(
            attrs={
                'class': 'file -form-control',
                'data-language': 'ru',
                'data-show-upload': 'false',
                'data-show-remove': 'false',
                'data-show-preview': 'false',
                'data-browse-on-zone-click': 'true',
            }))
예제 #2
0
class ImovelForm(forms.ModelForm):
    fotos = forms.ImageField(
        label='Adicionar fotos',
        required=False,
        widget=widgets.ClearableFileInput(attrs={'multiple': True}))

    class Meta:
        model = Imovel
        fields = '__all__'
예제 #3
0
class SkillForm(ModelForm):
    is_draft = DraftField

    name = forms.CharField(
        required=True,
        widget=forms.TextInput(attrs={'placeholder': 'Name the skill'}),
        error_messages={'required': 'You must give a name to the skill'},
    )
    description = forms.CharField(
        widget=widgets.Textarea(attrs={'placeholder': 'Describe the skill'}),
        error_messages={'required': 'You must fill out a description'},
    )
    normal_flag_image = forms.ImageField(widget=widgets.ClearableFileInput(),
                                         required=False)
    completed_flag_image = forms.ImageField(
        widget=widgets.ClearableFileInput(), required=False)

    class Meta:
        model = Skill
        fields = [
            'name', 'description', 'is_draft', 'normal_flag_image',
            'completed_flag_image'
        ]
예제 #4
0
 class Meta:
     model = FaceData
     fields = '__all__'
     widgets = {
         'name':
         widgets.Input(attrs={
             "class": "form-control pull-right  ",
         }, ),
         'birthday':
         widgets.Input(attrs={
             "class": "form-control pull-right form_datetime ",
             'readonly': 'readonly'
         }, ),
         'gender':
         widgets.Select(attrs={
             "class": " select2",
             "name": "gender",
             'style': 'width:100%;'
         }),
         'mobile':
         widgets.Input(attrs={
             "class": "form-control pull-right  ",
         }, ),
         'joindate':
         widgets.Input(attrs={
             "class": "form-control pull-right form_datetime ",
             'readonly': 'readonly'
         }, ),
         'department':
         widgets.Select(attrs={
             "class": " select2",
             "name": "department",
             'style': 'width:100%;'
         }),
         'face_id':
         widgets.Input(attrs={
             "class": "form-control pull-right  ",
         }, ),
         'face_name':
         widgets.Input(attrs={
             'class': "form-control",
             'rows': "3"
         }),
         'face_image':
         widgets.ClearableFileInput(attrs={
             'class': "form-control",
             'rows': "3"
         }),
     }
예제 #5
0
class ImovelRelatedForm(forms.ModelForm):
    UF = forms.CharField(label='UF', max_length=2, required=True)
    cidade = forms.CharField(label='Cidade', max_length=50, required=True)
    cep = forms.CharField(label='CEP', max_length=10, required=False)
    nome = forms.CharField(label='Nome', max_length=100, required=True)
    descricao = forms.CharField(label='Descrição',
                                widget=forms.Textarea(),
                                max_length=2000,
                                required=False)
    logradouro = forms.CharField(label='Logradouro',
                                 max_length=50,
                                 required=True)
    numero = forms.IntegerField(label='Número', min_value=0, required=False)
    complemento = forms.CharField(label='Complemento',
                                  max_length=30,
                                  required=False)
    status = forms.ModelChoiceField(label='Status',
                                    queryset=Status.objects.all(),
                                    widget=RelatedFieldWidgetCanAdd(Status))
    contato = forms.CharField(label='Contato',
                              max_length=500,
                              widget=forms.Textarea(),
                              required=False)

    fotos = forms.ImageField(
        label='Adicionar várias fotos',
        required=False,
        widget=widgets.ClearableFileInput(attrs={'multiple': True}))

    class Meta:
        exclude = ['imovel']

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        try:
            self.initial['UF'] = self.instance.imovel.UF
            self.initial['cidade'] = self.instance.imovel.cidade
            self.initial['cep'] = self.instance.imovel.cep
            self.initial['nome'] = self.instance.imovel.nome
            self.initial['logradouro'] = self.instance.imovel.logradouro
            self.initial['numero'] = self.instance.imovel.numero
            self.initial['complemento'] = self.instance.imovel.complemento
            self.initial['status'] = self.instance.imovel.status
            self.initial['contato'] = self.instance.imovel.contato
            self.initial['descricao'] = self.instance.imovel.descricao
        except:
            pass
예제 #6
0
class OutputOnlyEntranceTaskForm(EntranceTaskForm):
    task_type = 'output-only'

    solution = frontend.forms.RestrictedFileField(
        max_upload_size=512 * 1024,
        required=True,
        label='Выберите файл',
        label_suffix='',
        widget=widgets.ClearableFileInput(
            attrs={
                'class': 'file -form-control',
                'data-language': 'ru',
                'data-show-upload': 'false',
                'data-show-remove': 'false',
                'data-show-preview': 'false',
                'data-browse-on-zone-click': 'true',
            }))