Example #1
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     for field_name, field in self.fields.items():
         if field_name == 'comment':
             field.widget.attrs['placeholder'] = 'Type text here'
         if field_name == 'user':
             field.widget = forms.HiddenInput()
         if field_name == 'product':
             field.widget = forms.HiddenInput()
Example #2
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     for field_name, field in self.fields.items():
         field.widget.attrs['class'] = 'form-control'
         field.help_text = ''
         if field_name == 'password':
             field.widget = forms.HiddenInput()
Example #3
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     for field_name, field in self.fields.items():
         field.help_text = ''
         if field_name == 'password':
             field.widget = forms.HiddenInput()
         if field_name == 'avatar':
             field.widget.initial_text = ''
             field.widget.input_text = ''
             field.widget.clear_checkbox_label = ''
Example #4
0
class CreateApplyForm(forms.ModelForm):
    use = forms.ChoiceField(label=ugettext('贷款用途及贷款用途子类'),
                            choices=LOAN_USES,
                            widget=forms.Select(attrs={
                                'class': 'form-control',
                            }))
    description = forms.CharField(label=ugettext(''),
                                  widget=forms.Textarea(attrs={
                                      'class': 'form-control',
                                      'rows': 5,
                                  }))
    amount = forms.ChoiceField(label=ugettext('申请金额'),
                               choices=LOAN_AMOUNTS,
                               widget=forms.Select(attrs={
                                   'class': 'form-control',
                               }))
    education = forms.ChoiceField(label=ugettext('教育程度'),
                                  choices=EDUCATION_LEVEL,
                                  widget=forms.RadioSelect())
    marriage = forms.ChoiceField(label=ugettext('婚姻状况'),
                                 choices=MARRIAGE_STATE,
                                 widget=forms.RadioSelect())
    members = forms.ChoiceField(label=ugettext('家庭人口'),
                                choices=MEMBER_OF_FAMILY,
                                widget=forms.RadioSelect())
    incoming = forms.ChoiceField(label=ugettext('收入水平(全年收入月平均)'),
                                 choices=INCOMING_LEVEL,
                                 widget=forms.RadioSelect())
    property = forms.ChoiceField(label=ugettext('居住类型'),
                                 choices=PROPERTIES,
                                 widget=forms.RadioSelect())
    vehicle = forms.ChoiceField(label=ugettext('主要出行交通工具'),
                                choices=VEHICLES,
                                widget=forms.RadioSelect())
    residence = forms.CharField(label=ugettext('住宅地址'),
                                widget=forms.HiddenInput())
    employment = forms.ChoiceField(label=ugettext('受雇类型'),
                                   choices=EMPLOYMENTS,
                                   widget=forms.RadioSelect())
    company = forms.CharField(
        label=ugettext('公司名称'),
        required=False,
        widget=forms.TextInput(attrs={
            'class': 'form-control',
            'style': 'display:none',
        }))

    class Meta:
        model = Loan
        fields = []