Comment 10 for bug 681113

Revision history for this message
David Burke (bufke) wrote :

type(students)
<class 'django.db.models.query.QuerySet'>

students.__class__.__name__
'QuerySet'

I changed my odt template to say
do cell for student in iter(students)
This works.
From http://docs.djangoproject.com/en/dev/ref/models/querysets/

Iteration. A QuerySet is iterable, and it executes its database query the first time you iterate over it. For example, this will print the headline of all entries in the database:
for e in Entry.objects.all():
    print e.headline

iterator()
Evaluates the QuerySet (by performing the query) and returns an iterator over the results. A QuerySet typically caches its results internally so that repeated evaluations do not result in additional queries; iterator() will instead read results directly, without doing any caching at the QuerySet level. For a QuerySet which returns a large number of objects, this often results in better performance and a significant reduction in memory

Note that using iterator() on a QuerySet which has already been evaluated will force it to evaluate again, repeating the query.

So that's the difference between using iter() or not. Of course it still make little sense as to why we would ever see a blank in the former but not the later. Not sure what else to do here.