menyaring objek dalam template django

@register.filter
def in_category(things, category):
    return things.filter(category=category)

{% for category in categories %}
  {% for thing in things|in_category:category %}
    {{ thing }}
  {% endfor %}
{% endfor %}
Cruel Cicada