Skip to content

Instantly share code, notes, and snippets.

@loic
Created February 18, 2014 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loic/9067626 to your computer and use it in GitHub Desktop.
Save loic/9067626 to your computer and use it in GitHub Desktop.
loic84: FunkyBob: so you could customize the QS? like limit the number of related objects pulled from the db, or encapsulate more logic in QS methods.
13:49 loic84: say you want Blog.objects.get_queryset() to automatically perform a bunch of select_related/prefetch_related
13:50 loic84: when you do Article.objects.select_related('blog'), these are ignored.
13:51 loic84: so then you are left with 2 options, either you use prefetch_related('block') rather than select_related so you can use your custom manager, or you duplicate all the logic in the original select_related().
13:52 loic84: also you may want to select_related('blog') but defer() a bunch of fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment