I think filter_related is a good name, it's not that confusing that it sounds like select_related / prefetch_related. The current name is a bit weird because it's an adj + noun, it doesn't really say how it *modifies* the QuerySet, it sounds more declarative.
to_attr is also better, as it aligns with prefetch_related. On 29 August 2017 at 00:32, Josh Smeaton <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/django-developers/3f46645a-3535-42e1-9d3c-ef8e5d5d3694%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Adam -- 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/CAMyDDM1GaWgKV1fMnPpZgwJbtnzBJc__JsOdu6Z3Ea4f0ekugA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
