class DetailForm(forms.Form): inp = fields.TypedMultipleChoiceField( coerce=lambda x: int(x), initial=[1, 2], choices=((1, 'SH'), (2, 'BJ')) )
class LendingCustomsCForm(dform.Form): sure_c = fields.TypedMultipleChoiceField( label="反担保企业", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(LendingCustomsCForm, self).__init__(*args, **kwargs) self.fields['sure_c'].choices = models.Customes.objects.filter( genre=1).values_list('id', 'name').order_by('name')
class FormCustomAdd(dform.Form): custom = fields.TypedMultipleChoiceField( label="被告人", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(FormCustomAdd, self).__init__(*args, **kwargs) '''CUSTOM_STATE_LIST = ((1, '正常'), (99, '注销'))''' self.fields['custom'].choices = models.Customes.objects.filter( custom_state=1).values_list('id', 'name').order_by('name')
class MeetingAllotForm(dform.Form): # 分配项目评委 expert = fields.TypedMultipleChoiceField( label="评审委员", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(MeetingAllotForm, self).__init__(*args, **kwargs) '''EXPERT_STATE_LIST = ((1, '正常'), (2, '注销'))''' self.fields['expert'].choices = models.Experts.objects.filter( expert_state=1).order_by('ordery').values_list('id', 'name')
class FormDunAdd(dform.Form): cmpensatory = fields.TypedMultipleChoiceField( label="财产线索", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(FormDunAdd, self).__init__(*args, **kwargs) '''DUN_STATE_LIST = ((1, '已代偿'), (11, '已起诉'), (21, '已判决'), (31, '已和解'), (41, '执行中'), (91, '结案'))''' self.fields[ 'cmpensatory'].choices = models.Compensatories.objects.filter( dun_state=1).values_list('id', 'title').order_by('title')
class LendinStockForm(dform.Form): sure_stock = fields.TypedMultipleChoiceField( label="股权", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) ''' WARRANT_TYP_LIST = [ (1, '房产'), (2, '房产包'), (5, '土地'), (6, '在建工程'), (11, '应收账款'), (21, '股权'), (31, '票据'), (41, '车辆'), (51, '动产'), (55, '其他'), (99, '他权')]''' def __init__(self, *args, **kwargs): super(LendinStockForm, self).__init__(*args, **kwargs) self.fields['sure_stock'].choices = models.Warrants.objects.filter( warrant_typ=21).values_list('id', 'warrant_num').order_by('warrant_num')
class EmployeeForm(dform.Form): # 员工form EMPLOYEE_STATUS_LIST = [('在职', '在职'), ('离职', '离职')] employee_num = fields.CharField( label='用户名', label_suffix=":", required=True, # 记录上一次输入数 show_hidden_initial=True, # 覆盖默认错误提示 error_messages={'required': '不能为空'}, disabled=False, # 是否允许编辑 # 可自定义HTML属性 widget=widgets.TextInput(attrs={'class': 'ci'}), max_length=16, min_length=3) name = fields.CharField(label='员工姓名', label_suffix=":", max_length=16) id_code = fields.CharField(label='身份证号', label_suffix=":", max_length=18) department_id = fields.IntegerField(label='所属部门', label_suffix=":", widget=widgets.Select()) job = fields.TypedMultipleChoiceField(label='岗位', label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple()) age = fields.IntegerField(label='年龄', label_suffix=":", max_value=100, min_value=12) e_mail = fields.EmailField(label='电子邮箱', label_suffix=":", max_length=64) password = fields.CharField(label='密码', label_suffix=":", max_length=16, widget=widgets.PasswordInput()) employee_status = fields.IntegerField( label='状态', label_suffix=":", widget=widgets.Select(choices=EMPLOYEE_STATUS_LIST)) def __init__(self, *args, **kwargs): super(EmployeeForm, self).__init__(*args, **kwargs) self.fields['department'].widget.choices = \ models.Departments.objects.values_list( 'id', 'name').order_by('name') self.fields['job'].choices = \ models.Jobs.objects.values_list( 'id', 'name').order_by('name')
class MeetingArticleAddForm(dform.Form): # 添加评审项目 article = fields.TypedMultipleChoiceField( label="参评项目", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(MeetingArticleAddForm, self).__init__(*args, **kwargs) '''((1, '待反馈'), (2, '已反馈'), (3, '待上会'), (4, '已上会'), (5, '已签批'), (6, '已注销')) ((0, '--------------'), (1, '符合上会条件'), (2, '暂不符合上会条件'), (3, '建议终止项目'))''' self.fields['article'].choices = models.Articles.objects.filter( article_state=2, feedback_article__propose=1).values_list( 'id', 'article_num').order_by('article_num')
class FormClueAdd(dform.Form): warrant = fields.TypedMultipleChoiceField( label="财产线索", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) def __init__(self, *args, **kwargs): super(FormClueAdd, self).__init__(*args, **kwargs) '''WARRANT_STATE_LIST = ( (1, '未入库'), (2, '已入库'), (6, '无需入库'), (11, '续抵出库'), (21, '已借出'), (31, '解保出库'), (99, '已注销'))''' '''WARRANT_TYP_LIST = [ (1, '房产'), (2, '房产包'), (5, '土地'), (11, '应收'), (21, '股权'), (31, '票据'), (41, '车辆'), (51, '动产'), (99, '他权')]''' self.fields['warrant'].choices = models.Warrants.objects.exclude( warrant_state=99).exclude(warrant_typ=99).values_list( 'id', 'warrant_num').order_by('warrant_num')
class MeetingAddForm(dform.ModelForm): # 评审会添加 REVIEW_MODEL_LIST = models.Appraisals.REVIEW_MODEL_LIST review_model = fields.IntegerField(label='评审类型', label_suffix=":", initial=1, widget=widgets.Select( choices=REVIEW_MODEL_LIST, attrs={'class': 'form-control'})) review_date = fields.DateField(label='评审日期', label_suffix=":", initial=str(datetime.date.today()), widget=widgets.DateInput(attrs={ 'class': 'form-control', 'type': 'date' })) article = fields.TypedMultipleChoiceField( label="参评项目", label_suffix=":", coerce=lambda x: int(x), widget=widgets.SelectMultiple(attrs={'class': 'form-control'})) class Meta: model = models.Appraisals fields = [ 'compere', ] widgets = { 'compere': dform.Select(attrs={'class': 'form-control'}), } def __init__(self, *args, **kwargs): super(MeetingAddForm, self).__init__(*args, **kwargs) '''ARTICLE_STATE_LIST = ((1, '待反馈'), (2, '已反馈'), (3, '待上会'), (4, '已上会'), (5, '已签批'), (51, '已放完'), (61, '待变更'), (99, '已注销'))''' '''PROPOSE_LIST = ((1, '符合上会条件'), (11, '暂不符合上会条件'), (21, '建议终止项目'))''' self.fields['article'].choices = models.Articles.objects.filter( article_state=2, feedback_article__propose=1).values_list( 'id', 'article_num').order_by('article_num')