Just a small note, I've done a small prefetch framework (mind you, before
prefetch_related was implemented) here:
https://github.com/ionelmc/django-prefetch
It allows you to have a tailored prefetching process. It's a bit low level
but it supports all the scenarios you mentioned. If you think
On Friday, August 23, 2013 11:25:42 AM UTC-4, Andrew Ingram wrote:
> Essentially, I'm wondering if extending the prefetch_related concept is
> the right approach, and whether it's instead worth exploring the more
> general idea of "attaching stuff to models at the ORM level". There're a
> lot
I think that restriction is reasonable.
So this wouldn't work:
Publisher.objects.prefetch_related('authors', to_attr='authors_by_age',
queryset=Author.objects.order_by('age')).prefetch_related('
authors_by_age__books')
But this would:
On Friday, August 23, 2013 6:03:13 PM UTC+3, Marc Tamlyn wrote:
>
> Ticket #17001 concerns the ability to customise the querysets used when
> using `prefetch_related()`. This has a working implementation with a less
> than ideal API - see the patches on the ticket.
>
> As the API design seems to
The other restriction imposed by your suggested api is that the Count or
Model list will presumably only know the standard queryset api - with a
queryset= parameter any custom qs methods will work.
This is perhaps more necessary in the annotate case as it is naturally a
restricted api - select
Yeah, that was Marc's main issue with the idea too. Based on that
distinction it makes sense to keep the two as separate concepts, but as far
as API design is concerned it makes sense to try and make them feel similar.
On 23 August 2013 18:25, Anssi Kääriäinen wrote:
>
On Friday, August 23, 2013 6:25:42 PM UTC+3, Andrew Ingram wrote:
>
> I'd love to see this solved. I'm not sold on the API, but then again I've
> yet to see a single suggested API for this problem that I actually like.
>
> I showed you this a little while ago, you had some reservations with my
>
I'd love to see this solved. I'm not sold on the API, but then again I've
yet to see a single suggested API for this problem that I actually like.
I showed you this a little while ago, you had some reservations with my
idea, but I figured I might as well add it to the conversation anyway:
Ticket #17001 concerns the ability to customise the querysets used when
using `prefetch_related()`. This has a working implementation with a less
than ideal API - see the patches on the ticket.
As the API design seems to be the main issue here, Anssi and I bounced some
ideas around on IRC, and I