#32117: Aggregation doesnt work with Models, ordered by Meta subclass
-------------------------------------+-------------------------------------
     Reporter:  eloktev              |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Uncategorized        |                  Version:  3.1
     Severity:  Normal               |               Resolution:
     Keywords:  aggregation,         |             Triage Stage:
  database, psycopg2                 |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by eloktev:

Old description:

> Hello,
> Using aggregation methods with models, that have set 'ordering' in Meta
> subclass fails:
> {{{
> class M1 (models.Model)
>     date = models.DateField()
>     smth = models.IntegerField()
>
>     class Meta:
>         ordeing = 'smth'
> }}}
>
> {{{{
> count_by_day_qs =
> M1.objects.values('date').annotate(c=models.Count('id')).values('date',
> 'c')
> }}}}
> Returns executes following query:
> {{{{
> SELECT "m1"."date", COUNT("m1"."id") AS "c" FROM "m1" GROUP BY
> "m1"."date", "m1"."smth"
> }}}}

New description:

 Hello,
 Using aggregation methods with models, that have set 'ordering' in Meta
 subclass fails:
 {{{
 class M1 (models.Model)
     date = models.DateField()
     smth = models.IntegerField()

     class Meta:
         ordeing = 'smth'

 count_by_day_qs =
 M1.objects.values('date').annotate(c=models.Count('id')).values('date',
 'c')
 }}}}
 Returns executes following query:
 {{{{
 SELECT "m1"."date", COUNT("m1"."id") AS "c" FROM "m1" GROUP BY
 "m1"."date", "m1"."smth"
 }}}}

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32117#comment:1>
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/065.241e204159964c93cddcdb13207e0456%40djangoproject.com.

Reply via email to