#31023: Filtering DatetimeField by second not working on Django 2.2.7 (it works 
on
Django 1.10)
-------------------------------------+-------------------------------------
               Reporter:  Ismael     |          Owner:  nobody
  Jerez                              |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  2.2
  layer (models, ORM)                |       Keywords:  query, filter,
               Severity:  Normal     |  datetimefield, second
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 Hi:

 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.

-- 
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/057.bd585c8a44fb5f76502cb771e0b99fe7%40djangoproject.com.

Reply via email to