Opened 19 years ago
Closed 19 years ago
#2146 closed enhancement (wontfix)
[patch] small change to built-in tag regroup
| Reported by: | Matias Hermanrud Fjeld | Owned by: | Adrian Holovaty | 
|---|---|---|---|
| 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: | no | UI/UX: | no | 
Description
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 %}
<ul>
{% for group in groups %}
 <li>{{ group }}:
 {% for object in group %}
  {{ object }}
 {% endfor %}
 </li>
{% endfor %}
</ul>
The patch retains backwards compatability. One can still use the old syntax.
Attachments (1)
Change History (2)
by , 19 years ago
| Attachment: | regroup.diff added | 
|---|
comment:1 by , 19 years ago
| Resolution: | → wontfix | 
|---|---|
| Status: | new → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
This doesn't add a whole lot of value, so I'm marking as wontfix.