Ejemplo n.º 1
0
    def test_localization(self):
        w = AdminSplitDateTime()

        with self.settings(USE_L10N=True):
            with translation.override('de-at'):
                w.is_localized = True
                self.assertEqual(
                    conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))),
                    '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>',
                )
Ejemplo n.º 2
0
    def test_localization(self):
        w = AdminSplitDateTime()

        with self.settings(USE_L10N=True):
            with translation.override('de-at'):
                w.is_localized = True
                self.assertEqual(
                    conditional_escape(
                        w.render('test', datetime(2007, 12, 1, 9, 30))),
                    '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>',
                )
Ejemplo n.º 3
0
    def test_localization(self):
        w = AdminSplitDateTime()

        activate('de-at')
        old_USE_L10N = settings.USE_L10N
        try:
            settings.USE_L10N = True
            w.is_localized = True
            self.assertEqual(
                conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))),
                '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>',
            )
        finally:
            deactivate()
            settings.USE_L10N = old_USE_L10N
Ejemplo n.º 4
0
    def test_localization(self):
        w = AdminSplitDateTime()

        activate('de-at')
        old_USE_L10N = settings.USE_L10N
        try:
            settings.USE_L10N = True
            w.is_localized = True
            self.assertEqual(
                conditional_escape(w.render('test', datetime(2007, 12, 1, 9, 30))),
                '<p class="datetime">Datum: <input value="01.12.2007" type="text" class="vDateField" name="test_0" size="10" /><br />Zeit: <input value="09:30:00" type="text" class="vTimeField" name="test_1" size="8" /></p>',
            )
        finally:
            deactivate()
            settings.USE_L10N = old_USE_L10N