Python django.forms 模块,DateInput() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用django.forms.DateInput()

项目:planet-b-saleor    作者:planet-b    | 项目源码 | 文件源码
def is_date_input(field):
    return isinstance(field.field.widget, forms.DateInput)
项目:CinderellaProducers    作者:MagiCircles    | 项目源码 | 文件源码
def date_input(field):
    field.widget = DateInput()
    field.widget.attrs.update({
        'class': 'calendar-widget',
        'data-role': 'data',
    })
    return field

############################################################
# Account
项目:dappr    作者:millanp    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(PlaceholderInsteadOfLabelMixin, self).__init__(*args, **kwargs)
        for field_name in self.fields:
            field = self.fields.get(field_name)
            if field:
                if type(field.widget) in (forms.TextInput, forms.DateInput):
                    field.widget = forms.TextInput(attrs={'placeholder': field.label})
                    field.label = None
项目:helfertool    作者:helfertool    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(DatePickerField, self).__init__(*args, **kwargs)

        self.widget = DateInput(attrs={
            'class': 'date',
            'addon_before': '<span class="glyphicon glyphicon-calendar">'
                            '</span>'
        })
项目:MagiCircles    作者:MagiCircles    | 项目源码 | 文件源码
def date_input(field):
    field.widget = DateInput()
    field.widget.attrs.update({
        'class': 'calendar-widget',
        'data-role': 'data',
    })
    field.help_text = ' '
    return field

############################################################
# Form parents to handle request and save owner
项目:LDERP    作者:Ignoramuss    | 项目源码 | 文件源码
def clean(self):
        if 'password' in self.cleaned_data and 'confirm_password' in self.cleaned_data:
            if self.cleaned_data['password'] != self.cleaned_data['confirm_password']:
                raise forms.ValidationError(_("The two password fields did not match."))
        return self.cleaned_data

# class StudentInfoForm(forms.Form):
#     stud_name = forms.RegexField(required=True, regex=r'^\w+$', label='', max_length=200, widget=forms.TextInput(attrs={'placeholder': "First Name eg: Shiv", 'autofocus':'true'}))
#     stud_school = forms.RegexField(required=True, regex=r'^\w+$', label='', max_length=200, widget=forms.TextInput(attrs={'placeholder': "Student's School's Name"}))
#     stud_standard = forms.RegexField(required=True, regex=r'^\w+$', label='', max_length=30, widget=forms.TextInput(attrs={'placeholder': "Student's Standard"}))
#     stud_div = forms.RegexField(required=True, regex=r'^\w+$', label='', max_length=30, widget=forms.TextInput(attrs={'placeholder': "Student's Division"}))
#
#     date_of_fill = forms.DateField(required=True, input_formats=['%d-%m-%Y'], label='',widget=forms.DateInput(attrs={'placeholder': "Date of Filling", 'type':"date"}))
#     date_of_birth = forms.DateField(required=True, input_formats=['%d-%m-%Y'], label='', widget=forms.DateInput(attrs={'placeholder': "Date of Birth", 'type':"date"}))
#
#     father_name = forms.CharField(required=True, label='', max_length=200, widget=forms.TextInput(attrs={'placeholder': "Father's Full Name", 'autofocus':'true'}))
#     father_contact  = forms.CharField(required=True, label='', max_length=10, widget=forms.TextInput(attrs={'placeholder': "Eg 98xxxxxxx0"}))
#     father_email = forms.EmailField(required=True, label='', widget=forms.TextInput(attrs=dict(required=True, max_length=200, placeholder="Father's Email")))
#     father_education = forms.CharField(required=True, label='', max_length=200,widget=forms.TextInput(attrs={'placeholder': "Father's Education"}))
#     father_occupation = forms.CharField(required=True, label='', max_length=200,widget=forms.TextInput(attrs={'placeholder': "Father's Occupation"}))
#
#     mother_name = forms.CharField(required=True, label='', max_length=200,  widget=forms.TextInput(attrs={'placeholder': "Mother's Full Name",'autofocus': 'true'}))
#     mother_contact = forms.CharField(required=True, label='', max_length=10, widget=forms.TextInput(attrs={'placeholder': "Eg 98xxxxxxx0"}))
#     mother_email = forms.EmailField(required=True, label='', widget=forms.TextInput(attrs=dict(required=True, max_length=200, placeholder="Mother's Email")))
#     mother_education = forms.CharField(required=True, label='', max_length=200, widget=forms.TextInput(attrs={'placeholder': "Mother's Education"}))
#     mother_occupation = forms.CharField(required=True, label='', max_length=200, widget=forms.TextInput(attrs={'placeholder': "Mother's Occupation"}))
#
#     letter_identification = forms.BooleanField()
#     let_sound_assoc = forms.BooleanField()
#     spelling = forms.BooleanField()
#     reading = forms.BooleanField()
#     comprehension = forms.BooleanField()
#     composition = forms.BooleanField()
#     grammar = forms.BooleanField()
#
#     number_identification = forms.BooleanField()
#     forget_tables = forms.BooleanField()
#     carry_borr = forms.BooleanField()
#     frac_dec = forms.BooleanField()
#     problem_int = forms.BooleanField()
#     algebra = forms.BooleanField()
#
#     awareness = forms.IntegerField()
#     acceptance = forms.IntegerField()
#     active_participation = forms.IntegerField()
#     emo_support_provided = forms.IntegerField()
#     strength_awareness = forms.IntegerField()
#     parenting_style = forms.IntegerField()