#32059: Issue when counting a model extending auth_user by month
-------------------------------------+-------------------------------------
     Reporter:  anderleich           |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  2.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 My comment is too quick.
 [https://docs.djangoproject.com/en/3.1/topics/db/aggregation/#values The
 use of `values` means the `pk` should work too.].

 However, it looks like you've hit the
 [https://docs.djangoproject.com/en/3.1/topics/db/aggregation/#interaction-
 with-default-ordering-or-order-by default `order_by` issue] below the
 linked section there. (Note the `ORDER BY `auth_user`.`date_joined` DESC`
 in the SQL.) If you append `.order_by()` clearing the ordering it should
 work (as it is testing.)

 Hopefully that helps.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32059#comment:5>
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/068.58373487ef89ecac1dd580ecd074eef0%40djangoproject.com.

Reply via email to