I guess the only way to do this would be to use an if conditional,
which would be really ugly...

{% if content.model_type == 'post' %}
    {% include "content/post/include.html" %}
{% endif %}

{% if content.model_type == 'review' %}
    {% include "content/review/include.html" %}
{% endif %}



On Jan 30, 5:33 am, Super McFly <martinmal...@gmail.com> wrote:
> Thank you for the reply. Do you have any suggestions on how to do it
> my way?
>
> On Jan 30, 5:23 am, pyleaf <lg.feixi...@gmail.com> wrote:
>
> > i think that will not work,because 'include' excutes before the Variable.
>
> > On Sat, Jan 30, 2010 at 12:51 PM, Super McFly <martinmal...@gmail.com>wrote:
>
> > > Is it possible to use a template variable in the "include" template
> > > tag. My actual problem is below...
>
> > > {% include "content/{{ content.model_type }}/include.html" %}
>
> > > {{ content.model_type }} by itself outputs "post" and the full string
> > > outputs "content/post/include.html" and if that string is hard-coded
> > > then the template is included.
>
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > > "Django users" group.
> > > To post to this group, send email to django-us...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > 相信那一片天空会因你的执着而晴朗

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to