I am looping through a list of people, and want to output their
hyperlinked names separated by commas and then the word "and". It
should look like this:

<a href="b.html">Bob</a>,
<a href="f.html">Fred</a>,
<a href="d.html">Deidre</a> and
<a href="k.html">Kelly</a>

What is the best way of implementing this in a django template? Right
now I'm using a {% for %} loop, where each iteration prints a "," or
"and" or nothing depending on the iteration of the loop, using a bunch
of {% if %} statements to branch on these three cases.

This seems like it must be a common task though... is there a better
way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to