django-batch-select

  255 downloads
0.2.4 BSD License    
  not rated
Batch select many-to-many and one-to-many fields (to help avoid n+1 query problem)

description

download

specifications

django-batch-select was created to provide an equivalent to Django's select_related_ functionality. As of such it's another handy tool for avoiding the "n+1 query problem".

select_related_ is handy for minimizing the number of queries that need to be made in certain situations. However it is only usual for pre-selecting ForeignKey_ relations.

batch_select is handy for pre-selecting ManyToManyField_ relations and reverse ForeignKey_ relations.

It works by performing a single extra SQL query after a QuerySet_ has been evaluated to stitch in the the extra fields asked for. This requires the addition of a custom Manager_, which in turn returns a custom QuerySet_ with extra methods attached.
READ MORE   
Last updated on November 22nd, 2011

0 User reviews so far.

SUBMIT