예제 #1
0
class StoreRegister(Form):
    account = fields.CharField(
        label="账号",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    pwd = fields.CharField(
        label="密码",
        widget=widgets.PasswordInput(attrs={"class": "form-control"})
    )
    check_pwd = fields.CharField(
        label="确认密码",
        widget=widgets.PasswordInput(attrs={"class": "form-control"})
    )
    real_name = fields.CharField(
        label="真实姓名",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    identity_card = fields.CharField(
        label="身份证号",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    store_name = fields.CharField(
        label="商家名称",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    store_avatar = fields.ImageField(
        label="头像",
        required=False,
        widget=widgets.FileInput()
    )
    store_tel = fields.CharField(
        label="联系方式",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    address = fields.CharField(
        label="地址",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    open_time = fields.TimeField(
        label="开店时间",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    close_time = fields.TimeField(
        label="关店时间",
        widget=widgets.TextInput(attrs={"class": "form-control"})
    )
    remark = fields.CharField(
        label="商家介绍",
        widget=widgets.Textarea(attrs={"class": "form-control"})
    )
예제 #2
0
 def __init__(self, *args, **kwargs):
     """
     Have to pass a list of field types to the constructor, else we
     won't get any data to our compress method.
     """
     all_fields = (fields.DateField(), fields.TimeField())
     super(SplitDateTimeField, self).__init__(all_fields, *args, **kwargs)
예제 #3
0
    def __init__(self, *args, **kwargs):
        errors = self.default_error_messages.copy()
        if 'error_messages' in kwargs:
            errors.update(kwargs['error_messages'])

        localize = kwargs.get('localize', False)

        fields_ = (
            fields.DateField(error_messages={'invalid': errors['invalid']},
                             localize=localize),
            fields.TimeField(error_messages={'invalid': errors['invalid']},
                             localize=localize),
            fields.TimeField(error_messages={'invalid': errors['invalid']},
                             localize=localize),
        )
        super(DateTimeRangeField, self).__init__(fields_, *args, **kwargs)
예제 #4
0
파일: fields.py 프로젝트: nteetor/obietaxi
 def __init__(self, *args, **kwargs):
     """ Must pass a list of field types to the constructor """
     all_fields = (
         fields.CharField(max_length=10),
         fields.TimeField(),
     )
     super(BootstrapSplitDateTimeField,
           self).__init__(all_fields, *args, **kwargs)
예제 #5
0
class UpdateStoreForm(Form):
    store_id = fields.CharField(required=False)
    store_name = fields.CharField(
        label="商家名称",
        widget=widgets.TextInput(attrs={"class": "form-control"}))
    store_avatar = fields.ImageField(label="头像",
                                     required=False,
                                     widget=widgets.FileInput())
    store_tel = fields.CharField(
        label="联系方式",
        widget=widgets.TextInput(attrs={"class": "form-control"}))
    address = fields.CharField(
        label="地址", widget=widgets.TextInput(attrs={"class": "form-control"}))
    open_time = fields.TimeField(
        label="开店时间",
        widget=widgets.TextInput(attrs={"class": "form-control"}))
    close_time = fields.TimeField(
        label="关店时间",
        widget=widgets.TextInput(attrs={"class": "form-control"}))
    remark = fields.CharField(
        label="商家介绍", widget=widgets.Textarea(attrs={"class": "form-control"}))
예제 #6
0
 def __init__(self, *args, **kwargs):
     from curia.widgets import *
     errors = self.default_error_messages.copy()
     if 'error_messages' in kwargs:
         errors.update(kwargs['error_messages'])
     fields = (
         djfields.DateField(
             error_messages={'invalid': errors['invalid_date']}),
         djfields.TimeField(
             error_messages={'invalid': errors['invalid_time']}),
     )
     self.widget = SplitDateTimeWidget2
     super(SplitDateTimeField, self).__init__(fields, *args, **kwargs)
예제 #7
0
파일: views.py 프로젝트: EricLinjun/myblog
class dataForm(Form):

    driverName = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    date = fields.DateField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    location = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    plateNumber = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    project = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    quantity = fields.FloatField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={
            'required': "can't be null",
            'invalid': 'must be number'
        })
    receiveID = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    receiverName = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    category_id = fields.IntegerField()
    time = fields.TimeField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    unit = fields.CharField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})
    uploadTime = fields.DateTimeField(
        widget=widgets.TextInput(attrs={'class': 'form-control'}),
        error_messages={'required': "can't be null"})

    def __init__(self, *args, **kwargs):  # 自定义__init__
        super(dataForm, self).__init__(*args, **kwargs)
        self.fields['category_id'].widget = widgets.Select(
            choices=material.objects.values_list('id', 'categoryName'),
            attrs={'class': 'form-control'})