summaryrefslogtreecommitdiff
path: root/django/template/defaultfilters.py
AgeCommit message (Collapse)Author
2026-04-22Refs #10919 -- Refactored walk_items as module-level _walk_items and added ↵Rodrigo Vieira
truncated_unordered_list filter.
2025-07-28Fixed #36519 -- Made center template filter consistent for even/odd padding.mriduldhall
Refactored `center` template filter to match f-string behaviour, producing consistent padding for both odd and even fillings. Thanks Lily Acorn for the report and Natalia Bidart for the review. Co-authored-by: Lily Acorn <code@lilyf.org>
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2024-08-06Fixed CVE-2024-41989 -- Prevented excessive memory consumption in floatformat.Sarah Boyce
Thanks Elias Myllymäki for the report. Co-authored-by: Shai Berger <shai@platonix.com>
2024-04-24Fixed #35395 -- slice filter crashes on an empty dict with Python 3.12.Tim Richardson
Keep consistent behaviour of slice() filter between python 3.12 and prior versions in the case of a dict passed to the filter (catch the new to python 3.12 KeyError exception).
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-09-18Refs #33864 -- Removed length_is template filter per deprecation timeline.Mariusz Felisiak
2023-05-22Fixed #34577 -- Added escapeseq template filter.Arthur Moreira
2023-05-19Fixed #34578 -- Made "join" template filter respect autoescape for joiner.rajeeshp
2023-04-26Fixed #34518 -- Fixed crash of random() template filter with an empty list.David Sanders
2023-02-22Fixed #34363 -- Fixed floatformat crash on zero with trailing zeros.Panagiotis H.M. Issaris
Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124. Follow up to 4b066bde692078b194709d517b27e55defae787c.
2023-01-19Fixed #34272 -- Fixed floatformat crash on zero with trailing zeros to zero ↵David Wobrock
decimal places. Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124. Thanks Andrii Lahuta for the report.
2022-10-24Fixed #34098 -- Fixed loss of precision for Decimal values in floatformat ↵Vlastimil Zíma
filter. Regression in 12f7928f5a455e330c0a7f19bc86b37baca12811.
2022-07-23Fixed #33864 -- Deprecated length_is template filter.Nick Pope
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-10Simplified @stringfilter decorator and Library with unwrap().Baptiste Mispelon
Nowadays we can use inspect.unwrap() to retrieve the innermost function object when needed, and most of the uses of _decorated_function were to access the original __name__ which is not needed because @functools.wraps sets that attribute correctly.
2022-01-04Fixed CVE-2021-45116 -- Fixed potential information disclosure in dictsort ↵Florian Apolloner
template filter. Thanks to Dennis Brinkrolf for the report. Co-authored-by: Adam Johnson <me@adamj.eu>
2021-11-22Fixed #33302 -- Made element_id optional argument for json_script template ↵Baptiste Mispelon
filter. Added versionchanged note in documentation
2021-09-08Fixed #30086, Refs #32873 -- Made floatformat template filter independent of ↵Mariusz Felisiak
USE_L10N.
2020-10-13Fixed #20601 -- Allowed forcing format with thousand separators in ↵Jacob Walls
floatformat filter. Thanks Claude Paroz and Nick Pope for reviews.
2020-05-11Refs #30116 -- Simplified regex match group access with Match.__getitem__().Jon Dufresne
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
2020-03-17Fixed #31172 -- Added note to translators for yesno filter.Hasan Ramezani
2019-10-31Fixed #30761 -- Prevented floatformat filter from returning a negative zero.Sky
2019-06-11Fixed #27486 -- Fixed Python 3.7 DeprecationWarning in intword and ↵Jon Dufresne
filesizeformat filters. intword and filesizeformat passed floats to ngettext() which is deprecated in Python 3.7. The rationale for this warning is documented in BPO-28692: https://bugs.python.org/issue28692. For filesizeformat, the filesize value is expected to be an int -- it fills %d string formatting placeholders. It was likely coerced to a float to ensure floating point division on Python 2. Python 3 always does floating point division, so coerce to an int instead of a float to fix the warning. For intword, the number may contain a decimal component. In English, a decimal component makes the noun plural. A helper function, round_away_from_one(), was added to convert the float to an integer that is appropriate for ngettext().
2019-05-03Fixed #20122 -- Made pluralize template filter return '' on invalid input.Tobias Kunze
2019-05-03Refs #20122 -- Corrected documentation of pluralize template filter.Tobias Kunze
2018-09-25Refs #29784 -- Normalized Python docs links to omit the version.Jon Dufresne
2018-08-21Fixed #29654 -- Made text truncation an ellipsis character instead of three ↵Claude Paroz
dots. Thanks Sudhanshu Mishra for the initial patch and Tim Graham for the review.
2018-08-01Fixed typos in comments and docs.luz.paz
2018-07-09Removed unneded str() calls prior to mark_safe(); simplified mark_safe().Sergey Fedoseev
2018-05-26Fixed #29432 -- Allowed passing an integer to the slice template filter.ryabtsev
2018-02-23Fixed #29154 -- Corrected examples in pluralize docstring and added tests.Hasan Ramezani
2018-02-07Fixed #17419 -- Added json_tag template filter.Jonas Haag
2018-01-21Fixed #29038 -- Removed closing slash from HTML void tags.Jon Dufresne
2017-12-19Simplified and improved performance of floatformat filter.Mariusz Felisiak
Thanks Sergey Fedoseev for the review.
2017-12-04Fixed #28860 -- Removed unnecessary len() calls.Дилян Палаузов
2017-10-20Fixed #28662 -- Silenced join template filter error if arg isn't iterable.Mads Jensen
2017-10-18Fixed #28711 -- Fixed unordered_list template filter with lazy translations.Jonas Haag
2017-09-30Removed always True if check in stringfilter decorator.Mads Jensen
2017-09-07Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."Tim Graham
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
2017-08-22Refs #28502 -- Complemented stringformat tuple handling/test.Claude Paroz
An additional test and a code change were suggested in a late review.
2017-08-21Fixed #28502 -- Made stringformat template filter accept tuplesSrinivas Reddy Thatiparthy
2017-06-28Fixed #27818 -- Replaced try/except/pass with contextlib.suppress().Mads Jensen
2017-02-17Refs #27656 -- Updated django.template/tag docstring verbs according to PEP 257.Anton Samarchyan
2017-02-07Refs #27795 -- Removed force_text from the template layerClaude Paroz
Thanks Tim Graham for the review.
2017-02-07Converted usage of ugettext* functions to their gettext* aliasesClaude Paroz
Thanks Tim Graham for the review.
2017-01-26Refs #23919 -- Replaced usage of django.utils.http utilities with Python ↵Claude Paroz
equivalents Thanks Tim Graham for the review.
2017-01-26Refs #23919, #27778 -- Removed obsolete mentions of unicode.Vytis Banaitis
2017-01-23Assumed iri_to_uri always returns a stringClaude Paroz
Thanks Tim Graham for the review.
2017-01-21Refs #5748 -- Removed obsolete Python/Windows workarounds in floatformat filter.Tim Graham