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