I feel like I am writing something that should already exist.
Does Django have a template filter that joins a list of items on commas and places and 'and' before the last one?
For example:
a = ['foo',]
b = ['bar', 'baz',]
c = a + b
d = c + ['yourmom',]
The filter I am looking for would display each list in the following ways:
a would display 'foo'.
b would display'bar and baz'.
c would display 'foo, bar, and baz'.
d would display 'foo, bar, baz, and yourmom'.
QUESTION 1: Is there something that does that already?
I tried to write this myself and it is breaking in two places:
My code: http://pastie.org/private/fhtvg5tchtwlnrdyuoyeja
QUESTION 2: It breaks on forloop.counter & tc.author.all|length. Please explain why these are not valid.