On 07-Feb-08, at 10:45 AM, toomim wrote:

> 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?

compute and add these in your view - you need an extra field, say,  
'sep' which would be ',', '' or 'and' and in your template:
<a href = {{var}}>whatever</a> {{sep}}

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/
Foss Conference for the common man: http://registration.fossconf.in/web/



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to