summaryrefslogtreecommitdiff
path: root/django/template
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-03-12Encapsulated loop logic to avoid leaking module-level variables.Emmanuel Ferdman
2026-02-24Delete leaking loop iter vars in `smartif.py`sobolevn
While working on https://github.com/typeddjango/django-stubs/pull/3114/changes#diff-c408a224a641ee1ad26789d61b19c64c44667c1feb8fce0d58aea0338844ca66R276-R278 we have noticed that loop variables leak into the module namespace. It has two negative effects: 1. Users can access `smartif.op` and `smartif.key` public attrs, which is clearly not intenteded 2. We in `django-stubs` have to ignore these two objects from annotations Let's remove them :)
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.
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
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-09-12Refs #35667 -- Cached Django file prefixes for warnings.Adam Johnson
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-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-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-23Refs #36500 -- Shortened some long docstrings and comments.Mike Edmunds
Manually reformatted some long docstrings and comments that would be damaged by the to-be-applied autofixer script, in cases where editorial judgment seemed necessary for style or wording changes.
2025-07-23Removed double spaces after periods and within phrases.Sarah Boyce
2025-06-27Fixed #15727 -- Added Content Security Policy (CSP) support.Rob Hudson
This initial work adds a pair of settings to configure specific CSP directives for enforcing or reporting policy violations, a new `django.middleware.csp.ContentSecurityPolicyMiddleware` to apply the appropriate headers to responses, and a context processor to support CSP nonces in templates for safely inlining assets. Relevant documentation has been added for the 6.0 release notes, security overview, a new how-to page, and a dedicated reference section. Thanks to the multiple reviewers for their precise and valuable feedback. Co-authored-by: Natalia <124304+nessita@users.noreply.github.com>
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-17Fixed #28050 -- Added template name to TemplateSyntaxError.farhan
2025-03-31Refs #28909 -- Simplified code using unpacking generalizations.Aarni Koskela
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-24Improved and reorganized querystring template tag docstring and ref docs.Natalia
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-01Applied Black's 2025 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/25.1.0
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.
2024-12-06Fixed #35493 -- Allowed template self-inclusion with relative paths.Gabriel Nick Pivovarov
Co-authored-by: Brock <bsmick97@gmail.com>
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-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-22Applied optimizations to template.utils.get_app_template_dirs().sobolevn
2024-07-15Refs #10941 -- Renamed query_string template tag to querystring.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).
2024-03-27Fixed #35233 -- Moved template engine system checks to backend methods.Giannis Terzopoulos
Thanks Adam Johnson for reviews.
2024-03-10Fixed #35286 -- Updated broken link in django/template/smartif.py docstring.umair mehmood
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-11-24Fixed #34983 -- Deprecated django.utils.itercompat.is_iterable().Nick Pope
2023-10-26Fixed #10941 -- Added {% query_string %} template tag.Tom Carrick
2023-10-02Fixed #34883 -- Allowed template tags to set extra data on templates.Carlton Gibson
By setting a value in the `parser.extra_data` mapping, template tags pass additional data out of the parsing context. Any extra data set is exposed on the template via the matching `.extra_data` attribute. Library authors should use a key to namespace extra data. The 'django' namespace is reserved for internal use.
2023-09-29Fixed #34878 -- Fixed autoreloader crash when FORM_RENDERER is set to ↵Dan Jacob
TemplatesSetting. Regression in 439242c5943e16dd5a3a68fadac76e5e723eb323.
2023-09-18Refs #33864 -- Removed length_is template filter per deprecation timeline.Mariusz Felisiak
2023-08-09Fixed #34692 -- Made autoreloader reset cached template loader for default ↵priyank.panchal
renderer.