Re: (Newbie) Stuck with annotate() docs

2016-04-28 Thread Ankush Thakur
Yup! Makes sense now. I hope it saves someone some trouble someday. :-) Thanks a lot, Tim! Best, Ankush On Thursday, April 28, 2016 at 12:21:35 AM UTC+5:30, Tim Graham wrote: > > Please give this a try: https://github.com/django/django/pull/6524 > > On Wednesday, April 27, 2016 at 10:45:03 AM UT

Re: (Newbie) Stuck with annotate() docs

2016-04-27 Thread Tim Graham
Please give this a try: https://github.com/django/django/pull/6524 On Wednesday, April 27, 2016 at 10:45:03 AM UTC-4, Ankush Thakur wrote: > > I'm not sure how Book.objects.first().chapters is different > from Book.objects.first().chapters.count(), but the point is that > "chapters" is not defin

Re: (Newbie) Stuck with annotate() docs

2016-04-27 Thread Ankush Thakur
I'm not sure how Book.objects.first().chapters is different from Book.objects.first().chapters.count(), but the point is that "chapters" is not defined in the models at the top of that page! The snippet makes sense if I treat Book.chapters as another ManyToManyField (like authors), but it's rea

Re: (Newbie) Stuck with annotate() docs

2016-04-26 Thread Tim Graham
Looks like a typo. Does the rest of the example make sense and work if that line is changed to "Book.objects.first().chapters"? On Tuesday, April 26, 2016 at 12:50:31 PM UTC-4, Ankush Thakur wrote: > > Folks, I'm having exceptional trouble understanding annotate(), > aggregate(), and their vario

(Newbie) Stuck with annotate() docs

2016-04-26 Thread Ankush Thakur
Folks, I'm having exceptional trouble understanding annotate(), aggregate(), and their various combinations. I'm currently stuck here: https://docs.djangoproject.com/en/1.9/topics/db/aggregation/#combining-multiple-aggregations The example here uses Book.objects.first().chapters.count(), but th