Fetching contributors…
Cannot retrieve contributors at this time
28 lines (18 sloc) 552 Bytes

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: