Re: Making QuerySets composable

2016-01-24 Thread Anssi Kääriäinen
We have room for some improvement here. It should be possible to add subqueries to the current query. This would be especially useful for adding aggregates. For aggregates we need this feature because the current API doesn't work for anything but simple cases. For example Book.objects.annotate(aut

Re: Making QuerySets composable

2016-01-22 Thread Patryk Zawadzki
pt., 22.01.2016 o 17:44 użytkownik charettes napisał: > Hi Patryk, > > > > Currently we have Prefetch objects that kind of solve this problem for > M2M > > relations but perhaps it would be nice to also be able to use QuerySets > in > > select_related() or even in filter(). I don't think Prefetch

Re: Making QuerySets composable

2016-01-22 Thread charettes
Hi Patryk, > Currently we have Prefetch objects that kind of solve this problem for M2M > relations but perhaps it would be nice to also be able to use QuerySets in > select_related() or even in filter(). I don't think Prefetch objects are best > suited for that and I personally find having to in

Making QuerySets composable

2016-01-22 Thread Patryk Zawadzki
Hi, Currently the way QuerySets work makes it hard to reuse code. Consider an example where I have template tags to render an author and a book (that in turn displays author). I don't want my template code to execute any additional queries per row displayed so I am forced to prefetch everything up