#25977: Allow different filters on multiple aggregates
-------------------------------------+-------------------------------------
Reporter: agronick | Owner: nobody
Type: New feature | Status: closed
Component: Database layer | Version: 1.9
(models, ORM) |
Severity: Normal | Resolution: invalid
Keywords: QuerySet.extra | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by charettes):
* status: new => closed
* resolution: => invalid
Comment:
Hi agronick,
From your question I suspect you're not comfortable with
[https://docs.djangoproject.com/en/1.9/topics/db/queries/#following-
relationships-backward querying backward relationships] and
[https://docs.djangoproject.com/en/1.9/topics/db/queries/#complex-lookups-
with-q-objects negating a lookup].
I suggest you define an explicit `related_name='jobs'` on the `ForeignKey`
pointing to `JobGroup` and you pass a `~Q(jobs__state='0')` object to
define your `store_count` aggregate.
Please use our support channels at TicketClosingReasons/UseSupportChannels
for further help as the report doesn't show you have to resort to
`QuerySet.extra()` here.
--
Ticket URL: <https://code.djangoproject.com/ticket/25977#comment:7>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.dbf38db56fc49bd69bb54519d567ac78%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.