Basically, I have a colon delimited variable being passed into my template that I would like to loop through to display each individual element.
I would like to be able to extract each of these names and then perform logic on them within my template.
If I could use python, I would do something like (note: file_type is the variable I have in my template):
file_type = "PDF:DOC:XLS"
for tipe in file_type.split(":"):
if tipe == "PDF":
print "<img src='pdf'/>"
elif tipe == "DOC":
print "<img src='doc'/>"
elif tipe == "XLS":
print "<img src='xls'/>"
else:
print "<img src='unrecognized'/>"
So basically, is there a split function in django-templates or has anyone come up with a crafty way to do this? I haven't been able to find anything. Thanks!