Python django.forms.DateTimeInput() Examples

The following are 4 code examples of django.forms.DateTimeInput(). 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 , or try the search function .
Example #1
Source File: test_datetimeinput.py    From djongo with GNU Affero General Public License v3.0 5 votes vote down vote up
def test_render_formatted(self):
        """
        Use 'format' to change the way a value is displayed.
        """
        widget = DateTimeInput(
            format='%d/%m/%Y %H:%M', attrs={'type': 'datetime'},
        )
        d = datetime(2007, 9, 17, 12, 51, 34, 482548)
        self.check_html(widget, 'date', d, html='<input type="datetime" name="date" value="17/09/2007 12:51">') 
Example #2
Source File: filters.py    From eventoL with GNU General Public License v3.0 4 votes vote down vote up
def is_datetime(boundfield):
    """Return True if this field's widget is a DateInput."""
    return isinstance(boundfield.field.widget, forms.DateTimeInput) 
Example #3
Source File: test_templatetag_filters.py    From eventoL with GNU General Public License v3.0 4 votes vote down vote up
def test_is_datetime_with_DateTimeInput_should_return_true(mocker):
    boundfield = mocker.Mock()
    boundfield.field = mocker.Mock()
    boundfield.field.widget = forms.DateTimeInput()
    assert filters.is_datetime(boundfield) 
Example #4
Source File: test_datetimeinput.py    From djongo with GNU Affero General Public License v3.0 4 votes vote down vote up
def test_render_formatted(self):
        """
        Use 'format' to change the way a value is displayed.
        """
        widget = DateTimeInput(
            format='%d/%m/%Y %H:%M', attrs={'type': 'datetime'},
        )
        d = datetime(2007, 9, 17, 12, 51, 34, 482548)
        self.check_html(widget, 'date', d, html='<input type="datetime" name="date" value="17/09/2007 12:51">')