Alex Rivera | Logout

How to pass boolean keyword argument along with the use of "Include" template tag

Asked 2012-08-03T22:52:43.527
12
{% include "example.html" with name="John" hide_last_name=True %}

Basically, I am trying to include "example.html" as a sub-template in my main template. Additional context is provided with the mean of passing the keyword arguments name and hide_last_name. While the django template system has no trouble recognize name, it somehow just can't recognize hide_last_name. I suspect the use of boolean keyword argument in Include tag is now allowed but then I can't find anywhere in the official docs mentions that. Please help out. Thanks.

Edit
Report

1 Answer

2

In django 1.5 you can use True in django templates as per their release notes.

And if you are working on earlier versions you would have to go for what @okm suggested!

answered 2013-05-13T07:08:19.377

Your Answer