how to integrate kid template with django

9 views
Skip to first unread message

Roger Sun

unread,
Jun 14, 2006, 7:52:52 AM6/14/06
to django...@googlegroups.com
hi, everybody.

I don't like the django templates, can i use kid ?
if can, how can i do then?

thanks.

--
welcome: http://www.webwork.cn

Simon Willison

unread,
Jun 14, 2006, 10:30:48 AM6/14/06
to django...@googlegroups.com

On 14 Jun 2006, at 12:52, Roger Sun wrote:

> I don't like the django templates, can i use kid ?
> if can, how can i do then?

Yes you can. Here's an example:

from django.http import HttpResponse
import kid

def index(request):
# Set up any variables you might want to use
template = kid.Template(
file='/path/to/template.kid',
foo='Bar', baz='bling'
)
return HttpResponse(template.serialize())

That's it! Django is designed to completely decouple HTML generation
etc from the views, so it's very easy to use whatever method you want
to generate the content to be sent back in the HttpResponse.

Hope that helps,

Simon

Roger Sun

unread,
Jun 14, 2006, 8:59:20 PM6/14/06
to django...@googlegroups.com
Hi, Simon,
Thanks for your help..... ~_~.

Best regards,

roger


--
welcome: http://www.webwork.cn

Reply all
Reply to author
Forward
0 new messages