Opened 6 years ago

Closed 6 years ago

Last modified 5 months ago

#13088 closed New feature (wontfix)

Template range filter

Reported by: makoste Owned by: nobody
Component: Template system Version: 1.2-beta
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by timgraham)

def range( value ):
    Filter - returns a list containing range made from given value
    Usage (in template):

    <ul>{% for i in 3|range %}
      <li>{{ i }}. Do something</li>
    {% endfor %}</ul>

    Results with the HTML:
      <li>0. Do something</li>
      <li>1. Do something</li>
      <li>2. Do something</li>

    Instead of 3 one may use the variable set in the views
  return range( value )

Change History (2)

comment:1 Changed 6 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

My impression of this idea is that it is trying to lead to programming in the template. If you have a list of options that need to be rendered, they should be computed in the view, not in the template. If that's as simple as a range of values, then so be it.

comment:2 Changed 5 months ago by timgraham

  • Description modified (diff)
  • Easy pickings unset
  • Severity set to Normal
  • Type set to New feature
  • UI/UX unset
Note: See TracTickets for help on using tickets.
Back to Top