Blog Archive for March 13, 2010

Django Letter Headings

March 13, 2010

Here's some code, taken from a Django template, that will output a letter header each time the name of the piece changes to start with a different letter. This assumes that the piece names are in alphabetical order.

<ul id="pieces" title="Pieces" selected="true">
{% for piece in Pieces %} 
  {% ifchanged …