Newb question here.  How do I pass raw sql results to my template?
The sql results contains a two column queryset with several rows .

Below doesn't work.  How do I make this work?  Do I need to parse the
results into an array and then pass to the template?

IN THE VIEW:
cursor = connection.cursor()
cursor.execute("query goes here")
results = cursor.fetchall()

return render_to_response('template.html', {'results': results})

IN THE TEMPLATE:
{% for result in results %}
    <br>{{ result[0] }} is a big {{ result[1] }}
{% endfor %}


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.


Reply via email to