On Sun, 2008-04-13 at 01:52 -0700, fizban wrote: > Hi, > > Given that I'm using django-tagging to show a tagcloud, is there any > way to, given "tag.font_size", to make the template print > "tag.font_size" times the letter "v"? > > What I'm trying to accomplish is to make a tagcloud compliant to the > htagcloud microformat draft.. so: > > <li class="v-popular">sometag</li> <- tag.font_size = 1 > <li class="vvvvv-popular">someothertag</li> <- tag.font_size = 5 > > I haven't been able to find any reference to "reiterations" in the > django templates documentation (and {% for elem in elem_list %} > doesn't obviously fit.. so it leads me to think there isn't an easy > way to do so?
It's considered fairly easy to write a template filter and that would be one way to do this: a filter that when applied to a template variable returned the appropriate string. If you're really wedded to the idea of using htagcloud (which doesn't exactly seem to have set the microformats world on fire), that's the approach that will be simplest. An approach thats even easier, if you're willing to change the CSS class names, is to use classes of popular1, popular2, etc., and then use class="popular{{ tag.font_size }}" in your template. But, again, that won't work for this particular draft spec. Smells like a problem with the spec to me, since it restricts the options a fair bit and makes for somewhat unreadable names, but so be it. Regards, Malcolm -- Why can't you be a non-conformist like everyone else? http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---