Template Rendring interpretator

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
from django.template import Context, Template
t = Template("My name is {{ my_name }}.")
c = Context({"my_name": "Adrian"})
t.render(c)
############################################################
#
def ip_address_processor(request):
return {'ip_address': request.META['REMOTE_ADDR']}
def some_view(request):
c = RequestContext(request, {'foo': 'bar'}, [ip_address_processor])
return t.render(c)