From 0abda4d277ffc60f6505feeea007f3c4a44823c9 Mon Sep 17 00:00:00 2001 From: kadai0308 Date: Mon, 26 May 2025 17:29:59 +0800 Subject: [PATCH] docs: update docs and CHANGES.rst --- CHANGES.rst | 1 + docs/templating.rst | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 37e777dc..63271214 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,7 @@ Unreleased - Drop support for Python 3.9. :pr:`5730` - Remove previously deprecated code: ``__version__``. :pr:`5648` +- Support for using @app.template_filter, @app.template_test, and @app.template_global decorators without parentheses. :pr:`5736` Version 3.1.1 diff --git a/docs/templating.rst b/docs/templating.rst index 23cfee4c..e5cb955a 100644 --- a/docs/templating.rst +++ b/docs/templating.rst @@ -145,7 +145,11 @@ that. You can either put them by hand into the :attr:`~flask.Flask.jinja_env` of the application or use the :meth:`~flask.Flask.template_filter` decorator. -The two following examples work the same and both reverse an object:: +The following examples work the same and all reverse an object:: + + @app.template_filter # use the function name as filter name + def reverse_filter(s): + return s[::-1] @app.template_filter('reverse') def reverse_filter(s):