Uh!! (Hits hand into forehead.) Yep, just including a template named
by a variable would have been much simpler.
However, it's all worked out nicely. Having seen just how easy it is
to write a custom template tag, I replaced the 'eval' tag with a
couple specialized tags, which render from anoth
Now that you have an eval tag, maybe you don't need this, but I think
Django already had a simpler solution to your problem:
Context:
buttonDecidedAtRunTime: 'button4.html'
thisPage: "/some/path"
blah.html:
{% include buttonDecidedAtRunTime %}
The argument to the include tag doesn't
Thanks for the encouragement, Alex. This was so easy, it should be a
first lesson in how to write a custom tag. It took about 15 minutes
and worked the first time!
from django import template
register = template.Library()
@register.tag(name="eval")
def do_eval(parser, token):
try:
t
I don't think it would be difficult to implement, either as a block
tag, or as a regular tag with context.
On Jul 4, 7:29 pm, Ben Kovitz <[EMAIL PROTECTED]> wrote:
> Is there an easy way in Django to do the following?
>
> In blah.html:
>
> {{ buttonDecidedAtRunTime }} blah blah blah
>
> In the
Is there an easy way in Django to do the following?
In blah.html:
{{ buttonDecidedAtRunTime }} blah blah blah
In the Context passed to blah.html at run-time:
buttonDecidedAtRunTime: '{% include "button4.html %}'
thisPage: "/some/path"
Naturally, the included template might be butt
5 matches
Mail list logo