Skip to content

Instantly share code, notes, and snippets.

@johnboxall
Created November 25, 2010 03:46
Show Gist options
  • Select an option

  • Save johnboxall/714869 to your computer and use it in GitHub Desktop.

Select an option

Save johnboxall/714869 to your computer and use it in GitHub Desktop.
def view(request, template_name):
def obj_iterator():
for obj in Objs.objects.iterator():
obj.do_something()
yield obj
ctx = {
'objs': obj_iterator
}
return render_to_response(template_name, ctx)
# Later in the Template!
{% for obj in objs %}
{{ obj }}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment