summaryrefslogtreecommitdiff
path: root/tests/template_tests
AgeCommit message (Collapse)Author
2026-04-28Fixed #35738 -- Deprecated double-dot variable lookups.David Smith
2026-04-22Refs #10919 -- Refactored walk_items as module-level _walk_items and added ↵Rodrigo Vieira
truncated_unordered_list filter.
2026-02-10Fixed #36903 -- Fixed further NameErrors when inspecting functions with ↵93578237
deferred annotations. Provide a wrapper for safe introspection of user functions on Python 3.14+. Follow-up to 601914722956cc41f1f2c53972d669ddee6ffc04.
2025-12-15Fixed #36783 -- Ensured proper handling of multi-value QueryDicts in ↵Marc Gibbons
querystring template tag. Co-authored-by: Jacob Walls <jacobtylerwalls@gmail.com> Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-12-05Fixed #36728 -- Validated template tag arguments at definition time.Jake Howard
Before, `context` and `content` were validated at compile time.
2025-12-01Fixed #36712 -- Evaluated type annotations lazily in template tag registration.Jacob Walls
Ideally, this will be reverted when an upstream solution is available for https://github.com/python/cpython/issues/141560. Thanks Patrick Rauscher for the report and Augusto Pontes for the first iteration and test.
2025-12-01Refs #35535 -- Used intended decorator in test_simple_block_tag_parens().Jacob Walls
2025-11-21Refs #36705 -- Added coverage for multiple types of enclosing punctuation in ↵Jacob Walls
urlize(). This case was inadvertently fixed in ad94446fcc5b50401dd0c48718502d5d1b92df58.
2025-09-04Refs #36559, #35667 -- Used skip_file_prefixes in PartialTemplate.source ↵farhan
warning.
2025-09-03Fixed #36559 -- Respected verbatim and comment blocks in PartialTemplate.source.farhan
2025-09-03Refs #36559 -- Ran template partial source tests in debug mode only.farhan
Added a warning for accessing PartialTemplate.source when debugging is disabled. Thanks Sarah Boyce for the idea.
2025-08-28Fixed #35533 -- Prevented urlize creating broken links given a markdown link ↵SaJH
input. Signed-off-by: SaJH <wogur981208@gmail.com>
2025-08-14Fixed #36410 -- Added support for Template Partials to the Django Template ↵farhan
Language. Introduced `{% partialdef %}` and `{% partial %}` template tags to define and render reusable named fragments within a template file. Partials can also be accessed using the `template_name#partial_name` syntax via `get_template()`, `render()`, `{% include %}`, and other template-loading tools. Adjusted `get_template()` behavior to support partial resolution, with appropriate error handling for invalid names and edge cases. Introduced `PartialTemplate` to encapsulate partial rendering behavior. Includes tests and internal refactors to support partial context binding, exception reporting, and tag validation. Co-authored-by: Carlton Gibson <carlton@noumenal.es> Co-authored-by: Natalia <124304+nessita@users.noreply.github.com> Co-authored-by: Nick Pope <nick@nickpope.me.uk>
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-28Added test for various widths in ↵mriduldhall
tests/template_tests/filter_tests/test_center.py.
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.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-07-22Fixed incorrectly concatenated string in ↵Mike Edmunds
SimpleBlockTagTests.test_simple_block_tag_with_context_missing_content().
2025-06-18Fixed #36465, Refs #35816 -- Disallowed '+' and '-' characters in template ↵haileyajohnson
variable names. Regression in 5183f7c287a9a5d61ca1103b55166cda52d9c647. Thank you to Jon Banafato and Baptiste Mispelon for the report.
2025-04-23Fixed #36341 -- Preserved whitespaces in wordwrap template filter.Matti Pohjanvirta
Regression in 55d89e25f4115c5674cdd9b9bcba2bb2bb6d820b. This work improves the django.utils.text.wrap() function to ensure that empty lines and lines with whitespace only are kept instead of being dropped. Thanks Matti Pohjanvirta for the report and fix. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-04-17Fixed #28050 -- Added template name to TemplateSyntaxError.farhan
2025-03-25Fixed #35529 -- Added support for positional arguments in querystring ↵Giannis Terzopoulos
template tag. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2025-03-24Fixed #36271 -- Raised TemplateSyntaxError when using a relative template ↵YogyaChugh
path with an unknown origin.
2025-03-24Fixed #36268 -- Added leading `?` in every querystring template tag result.Natalia
Thanks Sarah Boyce for the report.
2025-03-24Ensured consistency in naming in ↵Natalia
template_tests/syntax_tests/test_querystring.py.
2025-03-19Fixed #36000 -- Deprecated HTTP as the default protocol in urlize and ↵Ahmed Nassar
urlizetrunc.
2025-03-11Fixed #35816 -- Handled parsing of scientific notation in DTL. (#19213)haileyajohnson
* Refs #35816 -- Improved test coverage of FilterExpression. * Fixed #35816 -- Made FilterExpression parse scientific numbers. --------- Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2025-03-06Fixed CVE-2025-26699 -- Mitigated potential DoS in wordwrap template filter.Sarah Boyce
Thanks sw0rd1ight for the report.
2025-02-24Fixed #36186 -- Added forloop.length variable within a template for loop.Jonathan Ströbele
2025-02-13Fixed #36182 -- Returned "?" if all parameters are removed in querystring ↵Sarah Boyce
template tag. Thank you to David Feeley for the report and Natalia Bidart for the review.
2025-01-23Fixed #36013 -- Removed use of IDNA-2003 in django.utils.html.Mike Edmunds
Removed obsolete and potentially problematic IDNA 2003 ("punycode") encoding of international domain names in smart_urlquote() and Urlizer, which are used (only) by AdminURLFieldWidget and the urlize/urlizetrunc template filters. Changed to use percent-encoded UTF-8, which defers IDNA details to the browser (like other URLs rendered by Django).
2025-01-14Fixed #35998 -- Added caching to django.utils.html.urlize().Sarah Boyce
2024-12-06Fixed #35493 -- Allowed template self-inclusion with relative paths.Gabriel Nick Pivovarov
Co-authored-by: Brock <bsmick97@gmail.com>
2024-11-29Refs #10941 -- Added tests in querystring template tag.Natalia
These extra tests assert over the handling of empty params (None, empty dict, empty QueryDict), and also for dicts having non-string keys.
2024-11-29Refs #10941 -- Added helper and refactored tests for querystring template tag.Natalia
Thank you Sarah Boyce for the review and suggestions.
2024-11-28Fixed #35897 -- Removed unnecessary escaping in template's get_exception_info().Klaas van Schelven
2024-11-19Fixed #35535 -- Added template tag decorator simple_block_tag().Jake Howard
Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
2024-11-18Refs #35844 -- Fixed copying BaseContext and its subclasses on Python 3.14+.Mariusz Felisiak
super objects are copyable on Python 3.14+: https://github.com/python/cpython/commit/5ca4e34bc1aab8321911aac6d5b2b9e75ff764d8 and can no longer be used in BaseContext.__copy__().
2024-10-10Fixed #35789 -- Improved the error message raised when the tag must be first ↵ekinertac
in the template.
2024-09-17Fixed #35735 -- Enabled template access to methods and properties of classes ↵Fabian Braun
with __class_get_item__.
2024-09-16Improved TokenType.COMMENT test by using correct block syntax in template tests.Lily Foote
2024-09-03Fixed CVE-2024-45230 -- Mitigated potential DoS in urlize and urlizetrunc ↵Sarah Boyce
template filters. Thanks MProgrammer (https://hackerone.com/mprogrammer) for the report.
2024-08-08Fixed #35661 -- Fixed test_too_many_digits_to_rander() test crash on PyPy.Mariusz Felisiak
Thanks Michał Górny for the report.
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-07-25Added dedicated test for invalid inputs in floatformat template filter tests.nessita
Co-authored-by: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com>
2024-07-16Refs #10941 -- Renamed test file test_query_string.py to test_querystring.py.nessita
This follows previous renames made in 27043bde5b795eb4a605aeca1d3bc4345d2ca478.
2024-07-15Refs #10941 -- Renamed query_string template tag to querystring.Sarah Boyce
2024-07-10Improved test coverage of urlize.Sarah Boyce
2024-06-13Fixed #35417 -- Updated BaseContext.new() with values to create a context ↵George Y. Kussumoto
that can be flattened.
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).