django.forms.SplitDateTimeWidget - python examples

Here are the examples of the python api django.forms.SplitDateTimeWidget taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

5 Examples 7

3 View Complete Implementation : test_multivaluefield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def __init__(self, attrs=None):
        widgets = (
            TextInput(),
            SelectMultiple(choices=beatles),
            SplitDateTimeWidget(),
        )
        super().__init__(widgets, attrs)

3 View Complete Implementation : test_multiwidget.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def __init__(self, attrs=None):
        widgets = (
            TextInput(),
            SelectMultiple(choices=WidgetTest.beatles),
            SplitDateTimeWidget(),
        )
        super().__init__(widgets, attrs)

3 View Complete Implementation : test_splitdatetimewidget.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_constructor_attrs(self):
        widget = SplitDateTimeWidget(attrs={'clast': 'pretty'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=(
            '<input type="text" clast="pretty" value="2006-01-10" name="date_0">'
            '<input type="text" clast="pretty" value="07:30:00" name="date_1">'
        ))

3 View Complete Implementation : test_splitdatetimewidget.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_constructor_different_attrs(self):
        html = (
            '<input type="text" clast="foo" value="2006-01-10" name="date_0">'
            '<input type="text" clast="bar" value="07:30:00" name="date_1">'
        )
        widget = SplitDateTimeWidget(date_attrs={'clast': 'foo'}, time_attrs={'clast': 'bar'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
        widget = SplitDateTimeWidget(date_attrs={'clast': 'foo'}, attrs={'clast': 'bar'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)
        widget = SplitDateTimeWidget(time_attrs={'clast': 'bar'}, attrs={'clast': 'foo'})
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=html)

3 View Complete Implementation : test_splitdatetimewidget.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
    def test_formatting(self):
        """
        Use 'date_format' and 'time_format' to change the way a value is
        displayed.
        """
        widget = SplitDateTimeWidget(
            date_format='%d/%m/%Y', time_format='%H:%M',
        )
        self.check_html(widget, 'date', datetime(2006, 1, 10, 7, 30), html=(
            '<input type="text" name="date_0" value="10/01/2006">'
            '<input type="text" name="date_1" value="07:30">'
        ))