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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.