There's currently a patch https://github.com/django/django/pull/7560 for 
ticket https://code.djangoproject.com/ticket/27332 that implements custom 
join conditions. It was nearly ready for merge for 1.11 but slipped. There 
are some merge conflicts the author still needs to sort out, but nothing 
too onerous.

Example:

    Author.objects
          .filtered_relation(
              'book', alias='book_alice',
              condition=Q(book__title__iexact='poem by alice')
          )

It has received very little attention and I'd like to get it on the radar 
for folks that would like to see this implemented, and have some time to do 
review. I'll be trying to get some review done in the next few days 
depending on my schedule.

One minor concern I did have was with the naming of the `filtered_relation` 
queryset method. I was leaning towards `filter_related` to better align 
with select_related and prefetch_related but I'm not sure that's better, or 
if it gives the wrong idea about what the method does. It might also be 
worth renaming the `alias` kwarg to `to_attr` to align with 
prefetch_related API. (Even if you don't have time to review, bikeshedding 
names seems to be popular 'round these parts :) ).

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" 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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/3f46645a-3535-42e1-9d3c-ef8e5d5d3694%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to