Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-06-03 Thread Berco Beute
Passing a complete context to a simple_tag doesn't (yet?) work, as described here: http://groups.google.com/group/django-users/browse_thread/thread/ee830466be465704/a41d89fd476becb1#a41d89fd476becb1 I finally solved my problem by defining my own tag as follows: === from

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-06-02 Thread Berco Beute
That's seems to be working, the only thing I've left to do is passing the complete context from the template to the simple_tag, else the simple_tag won't be able to render the template. How is that normally done in Python? 2B On May 31, 7:32 am, Alex Morega <[EMAIL PROTECTED]> wrote: > Create

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-31 Thread @@
On 5/31/08, Alex Morega <[EMAIL PROTECTED]> wrote: > > > > On May 31, 2008, at 00:36 , Berco Beute wrote: > > > > > Unfortunately that doesn't work. This works: > > > > {{ include dir|concat:"/tag.html" }} > > > > But not this: > > > > {% include dir|concat:"/tag.html" %} > > > > Thanks, but I'm

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-30 Thread Alex Morega
On May 31, 2008, at 00:36 , Berco Beute wrote: > > Unfortunately that doesn't work. This works: > > {{ include dir|concat:"/tag.html" }} > > But not this: > > {% include dir|concat:"/tag.html" %} > > Thanks, but I'm still searching for a solution... Create your own tag - not an inclusion tag,

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-30 Thread Berco Beute
Unfortunately that doesn't work. This works: {{ include dir|concat:"/tag.html" }} But not this: {% include dir|concat:"/tag.html" %} Thanks, but I'm still searching for a solution... 2B On May 29, 11:18 pm, Johannes Dollinger <[EMAIL PROTECTED]> wrote: > You could use a filter: > >

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Johannes Dollinger
You could use a filter: @register.filter(name='concat') def concat(value, arg): return "%s%s" % (value, arg) and then {% include dir|concat:"/tag.html" %}. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute
I can surely pass the path variable into the context from within my view, but the view doesn't know which filename to include. So in the template, I would still have to combine path and filename when creating an include tag such as: {% include "dir/tag.html" %} But how can I combine the path

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-29 Thread Berco Beute
Inclusion tags sound good, but I'm not sure how it could solve my problem. In my template I would like to use an inclusion tag this way: ###template {% showTag 'tagName' %} ###inclusion tag @register.inclusion_tag('tag.html') def showTag(tagname): #... ###tag.html bla But

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-28 Thread [EMAIL PROTECTED]
Could you set the entire path variable from within your view, then pass the path, including the filename, into the context? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Re: Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-27 Thread Juanjo Conti
You should create an inclusion tag: http://www.djangoproject.com/documentation/templates_python/#inclusion-tags Juanjo -- mi blog: http://www.juanjoconti.com.ar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Use variables inside an 'include' tag (and/or: how to set a variable in a template)

2008-05-27 Thread Berco Beute
In the following 'include' tag the 'dir' may vary: {% include "dir/tag.html" %} so I would rather use something like: {% include {{ dir }}"/tag.html" %} which of course doesn't work. Is there a way to accomplish this? Being able to set a variable inside a template would solve the problem, but