I have the following classes in my model:

class Category:
  description = charField()

class Thing:
  self.description = charField()
  self.category(ForeignKey, Category)

I would like a page layed out like:

Category1
  * foo
  * bar
  * baz

CategoryX
  * woo
  * war
  * waz

etc.

The {% regroup %} tag looked promising, but I can not get it to work.

    {% regroup user.get_thing_list|dictsort:"category" by category as
grouped %\
}
    {% for category in grouped %}
    <p>
    {{ category.grouper }}
        {% for entry in category.list %}
        <!-- handle entry -->
        {% endfor %}
    </p>
    {% endfor %}

Reply via email to