Opened 3 years ago

Closed 3 years ago

#22162 closed New feature (wontfix)

new filter tags for string processing on templates

Reported by: alvaro@… Owned by: nobody
Component: Template system Version: 1.6
Severity: Normal Keywords: filter tags
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I created a new feature with more than 10 new function for String filter tags. I have a path that complements defaultfilter.py.

This path contains the following functions:

1-reverseString
2-trim
3-parseInt
4-endsWith
5-startsWith
6-toLowerCase
7-toUpperCase
8-arrayMin
9-arrayMax
10-exp
11-pow
12-factorial
13-toHiperLink
14-DictShowKeys
15-DictToString

Attachments (1)

extra_filters.py (4.8 KB) - added by alvaro@… 3 years ago.
this .py contains new features for filter tags.

Download all attachments as: .zip

Change History (2)

Changed 3 years ago by alvaro@…

Attachment: extra_filters.py added

this .py contains new features for filter tags.

comment:1 Changed 3 years ago by loic84

Resolution: wontfix
Status: newclosed

Hi alvaro@, thanks for your suggestion and taking the time to offer a patch, but it's very unlikely this ticket can be accepted. The set of filters that Django ships by default is deliberately minimal, and anything more specific is better handled in 3rd party libs.

Sadly this kind of simple wrappers only exist because Django templates' dot notation doesn't handle passing arguments to functions/methods. There are active discussions on the mailing about switching to Jinja2 which would address this issue.

Please note that you can probably do away with some of the filters in that list, namely trim, toLowerCase and toUpperCase since their equivalent string methods don't require arguments and can be called directly (e.g. {{ item.uper.strip }}).

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