Python django.forms.widgets.DateInput() Examples

The following are 2 code examples of django.forms.widgets.DateInput(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module django.forms.widgets , or try the search function .
Example #1
Source File: widgets.py    From tom_base with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, attrs=None):
        date_attrs = attrs
        time_attrs = attrs
        date_attrs['label'] = attrs.get('date-label', 'Observation Date')
        time_attrs['label'] = attrs.get('time-label', 'Observation Time')
        _widgets = (
            widgets.DateInput(attrs=date_attrs),
            widgets.TimeInput(attrs=time_attrs)
        )
        super().__init__(_widgets, attrs) 
Example #2
Source File: datetime.py    From jorvik with GNU General Public License v3.0 5 votes vote down vote up
def add_class_attrs(self, widget=None):
        super(DateTimeFieldRenderer, self).add_class_attrs(widget=widget)
        classes = widget.attrs.get('class', '')

        if isinstance(widget, DateTimeInput):  # Ora e data
            classes = add_css_class(classes, 'selettore-data-ora')

        elif isinstance(widget, DateInput):  # Solo data
            classes = add_css_class(classes, 'selettore-data')

        widget.attrs['class'] = classes