|
Project Information
Featured
Downloads
|
Cheetah template engine for DjangoUsage
News - Now released a version which is the stand alone module django_cheetahtemplates and contains the application of the example below. See the source svn repository for the most up to date code. ExamplePut this in your views from django_cheetahtemplates import render_cheetah_response,CheetahTemplate
from django.template import Context
from django.http import HttpResponse
def hello(request):
# Use shortcut
return render_cheetah_response('hello.tmpl', {'myvar':'hello world','range':range} )
def hello2(request):
# Create and render context
context = Context({'myvar':'hello'})
context['range'] = range
template = CheetahTemplate(filename='hello.tmpl')
return HttpResponse(template.render(context))Then create hello.tmpl somewhere in your TEMPLATE_DIRS $myvar #for i in $range(10) $i#slurp #end for When you go to the url linked to either hello or hello2 you will see this hello world 0123456789 Capabilities:
TODO:
|