Example #1
0
    def test_adapt(self):
        widget = widgets.AdminDateTimeInput()

        js_args = widgets.AdminDateTimeInputAdapter().js_args(widget)

        self.assertEqual(
            js_args[0],
            {"dayOfWeekStart": 0, "format": "Y-m-d H:i", "formatTime": "H:i"},
        )
    def test_adapt(self):
        widget = widgets.AdminDateTimeInput()

        js_args = widgets.AdminDateTimeInputAdapter().js_args(widget)

        self.assertEqual(js_args[0], {
            'dayOfWeekStart': 0,
            'format': 'Y-m-d H:i',
            'formatTime': 'H:i'
        })
Example #3
0
    def test_adapt_with_custom_format(self):
        widget = widgets.AdminDateTimeInput(
            format="%d.%m.%Y. %H:%M", time_format="%H:%M %p"
        )

        js_args = widgets.AdminDateTimeInputAdapter().js_args(widget)

        self.assertEqual(
            js_args[0],
            {"dayOfWeekStart": 0, "format": "d.m.Y. H:i", "formatTime": "H:i A"},
        )
    def test_adapt_with_custom_format(self):
        widget = widgets.AdminDateTimeInput(format='%d.%m.%Y. %H:%M',
                                            time_format='%H:%M %p')

        js_args = widgets.AdminDateTimeInputAdapter().js_args(widget)

        self.assertEqual(js_args[0], {
            'dayOfWeekStart': 0,
            'format': 'd.m.Y. H:i',
            'formatTime': 'H:i A'
        })