Groups items of a list by a property.

When the item is an integer then it is assumed to be the id of a resource. This is especially useful for grouping items in for-loops.

For example:

{% for grp in value|group_by:"a" %} ... loop over grp ... {% endfor %}

When value is the three element list:

 [{a,1}, {b,1}],

then the output of group_by “a” will be the two element list:


Edit on GitHub

flatten_value Lists index_of

Referred by


Filters transform template variables before they are rendered.