Ive made workaround for this case as external
app<https://bitbucket.org/andrew_pashkin/django-deep-prefetch>
.
On Sunday, February 9, 2014 12:14:32 AM UTC+4, Andrew Pashkin wrote:
>
> With GenericForeignKey functionality, it is possible to refer to
> arbitrary model. Let's ay we have Like model, which is naturally may
> refer to many types of data (blogposts, users, photos, comments, etc). And
> so it is desireable to be able to perform such lookups:
>
> Like.objects.prefetch_related('content_object__followers',
> 'content_object__people_on_photo')
>
> where followers is the field of User model and people_on_photo the field
> of Photo model.
>
> Currently .prefetch_related will raise an error like
>
> Cannot find field `followers` on Photo object.
>
> because currently it is assumed that lookups are 'strict', and data for
> each lookup is homogenous (stealed the word form comment in sources :).
> So I think it would be nice to implement feature for non-strict lookups in
> addition to #17001.
> <https://code.djangoproject.com/ticket/17001>
>
--
You received this message because you are subscribed to the Google Groups
"Django developers" 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].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/8b40412d-1740-4389-992c-2b5363e29545%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.