Re: include only columns from selected related models in select_related query

2019-02-13 Thread Josh Smeaton
Personally, I depend on this behaviour, but it's only because I'm aware of it. Others would be too though, so we can't just make that change (not that you're suggesting that approach). One approach I think could be good would be: Book.objects.select_related('author__hometown').defer("author").g

Re: include only columns from selected related models in select_related query

2019-02-11 Thread Riccardo Magliocchetti
Hello Collin, Il 11/02/19 17:35, Collin Anderson ha scritto: So would you "defer" the other columns like "only()"? Yeah, something like that If nothing else, you could try using .annotate(F('author__hometown')) (not sure if that works) or .values('author__hometown') to just get the values yo

Re: include only columns from selected related models in select_related query

2019-02-11 Thread Collin Anderson
So would you "defer" the other columns like "only()"? If nothing else, you could try using .annotate(F('author__hometown')) (not sure if that works) or .values('author__hometown') to just get the values you need. On Mon, Feb 11, 2019 at 5:50 AM Riccardo Magliocchetti < riccardo.magliocche...@gmai

include only columns from selected related models in select_related query

2019-02-11 Thread Riccardo Magliocchetti
Hello, I'm debugging views leaking lots of memory in django 1.11. It looks like there is some connections with my usage of select_related(). But that's mail is not about that, not sure about my findings yet :) So I have looked again at the select_related documentation here: https://docs.djang