#11293: Filters on aggregates lose connector
--------------------------------------------+-------------------------------
Reporter: [email protected] | Owner: -
Status: new | Milestone:
Component: ORM aggregation | Version: SVN
Resolution: | Keywords: having, where,
aggregate, connector
Stage: Accepted | Has_patch: 1
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 1 |
--------------------------------------------+-------------------------------
Comment (by glassresistor):
Just marked this as a duplicate,
[http://code.djangoproject.com/ticket/13692#comment:1], a person making or
improving this patch should probably look at it though since this is a
large bug and affects a wide range of functionality.
repost for quick search purposes
{{{
class Professional(models.Model):
hits = models.PositiveIntegerField()
class Article(models.Model):
hits = models.PositiveIntegerField()
authors = models.ManyToManyField(Professional)
class Query(models.Model):
hits = models.PositiveIntegerField()
author = models.ForeignKey(Professional, blank = True, null =
True)
Professional.objects.annotate(article_hits=Sum("article__hits"),
query_hits=Sum("query__hits")).exclude(Q(article_hits=None)&Q(query_hits=None))
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/11293#comment:17>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.