Python django.forms.DateTimeInput() Examples

The following are 4 code examples for showing how to use django.forms.DateTimeInput(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module django.forms , or try the search function .

Example 1
Project: eventoL   Author: eventoL   File: filters.py    License: GNU General Public License v3.0 5 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 2
Project: eventoL   Author: eventoL   File: test_templatetag_filters.py    License: GNU General Public License v3.0 5 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 3
Project: djongo   Author: nesdis   File: test_datetimeinput.py    License: 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 4
Project: djongo   Author: nesdis   File: test_datetimeinput.py    License: 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">')