Django Templates

May 18, 2010

To render a django template in your code, simply import the render_to_string function, pass it a template and a context, and it will return you back the template rendered with that context.

from django.template.loader import render_to_string

lRenderedString = render_to_string('template.htm', {'Class' : lClass})

Tags: django templates