django templates--programatically include files

8 views
Skip to first unread message

Niall

unread,
Jun 21, 2011, 7:48:20 AM6/21/11
to google-a...@googlegroups.com
Hi all

I have a page and it would be very useful for me to do the following: 
{% include projectNameFromTemplateArguments_a %}
where projectNameFromTemplateArguments_a is set in the template arguments when rendering the html.

But that doesn't seem to work in that form. I'm using a work around where I do some ifequal tests:
{% ifequal a b %}
  <div id="thinga">{% include "project1a.html" %}</div>
  <div id="thingb">{% include "project1b.html" %}</div>
  <div id="thingc">{% include "project1c.html" %}</div>
  <div id="thingd">{% include "project1d.html" %}</div>
{% else %} {% ifequal a c %}
  <div id="thinga">{% include "project2a.html" %}</div>
  <div id="thingb">{% include "project2b.html" %}</div>
  <div id="thingc">{% include "project2c.html" %}</div>
  <div id="thingd">{% include "project2d.html" %}</div>
{% endifequal %}

Is what I want possible? 

Thanks
Reply all
Reply to author
Forward
0 new messages