= CookBook - Template tag Regroup = django version : 0.91 If you need to group a list of objects by a choice (eg, field has '''choices = CATEGORY_CHOICES'''), here is the trick. '''The Model:''' {{{ #!python CATEGORY_CHOICES = ( (1, 'Entrées'), (2, 'Poissons et crustacés'), (3, 'Viandes et volailles'), (4, 'Légumes et accompagnements'), (5, 'Desserts'), (6, 'Boissons'), (8, 'Autres'), ) class Recette(meta.Model): [...] categorie = meta.SmallIntegerField(choices = CATEGORY_CHOICES) }}} And here is the {{{regroup}}} tag in action. The thing is that you don't want to display the category number, but its corresponding name. (e.g not '1' but 'Entrées'). '''The Template:''' {{{ #!python {% regroup recettes by categorie as grouped %} }}}