I recently update Django from version 1.10 to 2.2.7.
I have a query filtering like this:
{{{ MyModel.objects.filter(a_datetimefield__second=4).all() }}}
This returns me an empty QuerySet result.
But, If I try something like this just for testing:
{{{
MyModel.objects.filter(a_datetimefield__second_icontains='4').first().a_datetimefield.second
}}}
It returns {int} 4 !!!
I tried this too:
{{{ MyModel.objects.filter(a_datetimefield__second_exact=4).all() }}}
And the results is the same (empty QuerySet instance)
Using hour or minute works perfect, it only happens with second attribute.
Thanks in advance,
Ismael.
--
Ticket URL: <https://code.djangoproject.com/ticket/31023>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => needsinfo
Comment:
Thanks for this report, however I'm not able to reproduce this issue. If
you use `USE_TZ = True` then it can be related with the lack of
[https://docs.djangoproject.com/en/2.2/ref/models/querysets/#database-
time-zone-definitions time zone definitions in the database]. Can you
provide more details or a sample project?
--
Ticket URL: <https://code.djangoproject.com/ticket/31023#comment:1>