﻿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
31582	Django template engine render pre-fetches data even when iterator() is used	Sümer Cip	nobody	"Hi,

I was testing template engines with a memory profiler we have written and I have seen an interesting issue with Django template engine. Still not sure if this is an issue or intended.  

The database backend I use is django.db.backends.sqlite3. I am using following code to retrieve a huge list of objects:

{{{
comments = Comment.objects.all().iterator()
template = loader.get_template('polls/comments.html')
context = {
        'comments': comments,
    }
return HttpResponse(template.render(context, request))
}}}

And the template code:

{{{
{% for comment in comments %}
    a
{% endfor %}
}}}

When I ran the view, I see the {{{django.db.models.base.Comment.__init__}}} caches the results. If I change the TEMPLATE backend to {{{Jinja2}}} I verified it is not being cached.

Is this somewhat intended behaviour? If so, how can we disable Model caching for Django templates? "	New feature	closed	Template system	3.0	Normal	wontfix			Unreviewed	0	0	0	0	0	0
