template.Template.render()

Template.render(context) [source]

Call the Template object’s render() method with a Context to “fill” the template:

>>> from django.template import Context, Template
>>> template = Template("My name is {{ my_name }}.")

>>> context = Context({"my_name": "Adrian"})
>>> template.render(context)
"My name is Adrian."

>>> context = Context({"my_name": "Dolores"})
>>> template.render(context)
"My name is Dolores."
doc_Django
2016-10-09 18:39:54
Comments
Leave a Comment

Please login to continue.