I am relatively new to Django and I have a simple problem. In my template I have:
{% for article in article_list %}
<li>
{% for author in article.authors.all %}
{{ author.name }},
{% endfor %}
{{ article.title }}
</li>
{% endfor %}
What I want is to be able to iterate over the author.name but the last name should end with a period not a comma. Do I have to go back to the view to achieve this, or is there some simple way in the template?
In templates, for loops have a
firstandlastattribute, so you can do this: