Opened 9 years ago

Closed 9 years ago

#2146 closed enhancement (wontfix)

[patch] small change to built-in tag regroup

Reported by: Matias Hermanrud Fjeld Owned by: adrian
Component: Template system Version:
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


This patch makes the built-in tag regroup return group objects instead of dicts.
group objects are lists, but their str()-method returns the grouper.

This changes the syntax like so:

{{ group.grouped }} -> {{ group }}
{% for object in group.list %}... -> {% for object in group %}...

Thus one can write:

{% regroup something by attribute as groups %}
{% for group in groups %}
 <li>{{ group }}:
 {% for object in group %}
  {{ object }}
 {% endfor %}
{% endfor %}

The patch retains backwards compatability. One can still use the old syntax.

Attachments (1)

regroup.diff (3.0 KB) - added by Matias Hermanrud Fjeld <mhf@…> 9 years ago.

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by Matias Hermanrud Fjeld <mhf@…>

comment:1 Changed 9 years ago by adrian

  • Resolution set to wontfix
  • Status changed from new to closed

This doesn't add a whole lot of value, so I'm marking as wontfix.

Note: See TracTickets for help on using tickets.
Back to Top