﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
3470	related data injection for related managers to reduce number of queries	Ronny Pfannschmidt	nobody	"it would be nice, of querysets injected objects where used as query parameters to the result set

example using the polls app from the tutorial
{{{
#!python
from polls.models import *
from django.db import connection
Poll.objects.get(id=1).choice_set.all()[0].poll
}}}

results in 3 queries, since the related manager wont pass the orginal poll object to the instances of the choices

after this code connection.queries is
{{{
#!python
[
 {'time': '0.000', 
  'sql': 'SELECT ""polls_poll"".""id"",""polls_poll"".""question"",""polls_poll"".""pub_date"" FROM ""polls_poll"" WHERE (""polls_poll"".""id"" = 1)'},       
 {'time': '0.000', 
  'sql': 'SELECT ""polls_choice"".""id"",""polls_choice"".""poll_id"",""polls_choice"".""choice"",""polls_choice"".""votes"" FROM ""polls_choice"" WHERE (""polls_choice"".""poll_id"" = 1) LIMIT 1 '}, 
 {'time': '0.000', 
  'sql': 'SELECT ""polls_poll"".""id"",""polls_poll"".""question"",""polls_poll"".""pub_date"" FROM ""polls_poll"" WHERE (""polls_poll"".""id"" = 1)'}]
}}}

the same query twice just cause a python object doesn't get passed "	New feature	closed	Database layer (models, ORM)	dev	Normal	fixed			Accepted	0	0	0	0	0	0
