Ok, i'll stick with the building up into the view! Thanks, by searching older posts i found something, so i'll read those. Thanks again!
On 9 Nov, 13:09, Daniel Roseman <dan...@roseman.org.uk> wrote: > On Nov 9, 10:25 am, "samuele.mattiuzzo" <samum...@gmail.com> wrote: > > > > > > > Hi all, > > i have a problem with a django template. > > > i have a value (a number) stored into a mysql database and i'm > > accessing it using {{ totem.layout.communitySpace }} > > > This number sould be used to get a page: > > {% include "bacheche/clip_{{ totem.layout.communitySpace }}.html" %} > > > and it should return "clip_2.html" (for example). > > > This doesn't seem possible, since i receive "Page > > clip_{{ totem.layout.communitySpace }}.html not found" > > I also tried without using parenthesis, but i get the same error > > ("Page clip_totem.layout.communitySpace.html not found") and i have to > > use the "ifequal" tag to include the correct page, but this isn't > > dynamic at all, everytime we add a new page, we also have to edit the > > main template if - else's statements! > > > How can i manage this? Thank you all for your suggestions! > > There's nothing in the documentation to imply that you can use > variable tags inside other tags. You simply can't do that. > > You can use a variable (without the braces) as the argument to > include, so you should build up that value in your view. > Alternatively, you could add a method to totem or totem.layout, > whatever they are, to generate the name based on the value of > communitySpace. > -- > DR. -- 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.