#31608: forms.DateTimeField parses ISO 8601 datetime with offset as aware when
USE_TZ is False.
-------------------------------------+-------------------------------------
     Reporter:  Carlton Gibson       |                    Owner:  Hasan
                                     |  Ramezani
         Type:  Bug                  |                   Status:  assigned
    Component:  Forms                |                  Version:  3.1
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 So this caused a test failure on Django-Filter.

 I've adjusted the test case there to account for the new behaviour.

 https://github.com/carltongibson/django-filter/pull/1226

 {{{
 -    @override_settings(USE_TZ=False)
      def test_clean(self):
          w = RangeWidget()
          f = IsoDateTimeRangeField(widget=w)
 -        self.assertEqual(
 -            f.clean(['2015-01-01T10:30:01.123000+01:00',
 '2015-01-10T08:45:02.345000+01:00']),
 -            slice(datetime(2015, 1, 1, 9, 30, 1, 123000),
 -                  datetime(2015, 1, 10, 7, 45, 2, 345000)))
 +        expected = slice(
 +            datetime(2015, 1, 1, 9, 30, 1, 123000, tzinfo=timezone.utc),
 +            datetime(2015, 1, 10, 7, 45, 2, 345000, tzinfo=timezone.utc)
 +        )
 +        actual = f.clean(['2015-01-01T10:30:01.123000+01:00',
 '2015-01-10T08:45:02.345000+01:00'])
 +        self.assertEqual(expected, actual)
 }}}

 Let's assume we'll go with the docs change.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31608#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/071.89cb108cc03cac8943b924704eed858a%40djangoproject.com.

Reply via email to