There is such a date with a timezone of +00: 00, which needs to be stuffed into the DateTimeField

'2016-04-21T18:00:46.582Z' 

django.utils.dateparse.parse_date () returns None, strftime returns naive datetime, from which, apparently, the object is not saved. How to do it right?

    1 answer 1

    parse_date only parses the date, and for the date-time, parse_datetime used, which is quite aware of:

     >>> from django.utils import dateparse, timezone >>> d = dateparse.parse_datetime('2016-04-21T18:00:46.582Z') >>> d datetime.datetime(2016, 4, 21, 18, 0, 46, 582000, tzinfo=<UTC>) >>> d.tzinfo <UTC> >>> timezone.is_naive(d) False