summaryrefslogtreecommitdiff
path: root/django/template/__init__.py
AgeCommit message (Collapse)Author
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
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>
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2020-11-05Fixed #25791 -- Implement autoreload behaviour for cached template loader.Tom Forbes
2019-09-24Removed some outdated backwards compatibility imports and misleading comments.Mads Jensen
EmptyResultSet moved in 46509cf13dbf049f75077981c29ef2c60b5a96ab. FieldDoesNotExist moved in 8958170755b37ce346ae5257c1000bd936faa3b0. BoundField and pretty_name moved in 8550161e531a603d57723850fb09c4c9b7ca60b9. EMPTY_VALUES moved in 471596fc1afcb9c6258d317c619eaf5fd394e797. BaseRunserverCommand moved in 5c53e30607014163872e89c221b206992a9acfef.
2017-01-17Refs #25466 -- Removed aliases for LoaderOrigin and StringOrigin.Tim Graham
Per deprecation timeline.
2015-09-29Fixed #25466 -- Added backwards compatibility aliases for LoaderOrigin and ↵Tim Graham
StringOrigin. Thanks Simon Charette for the DeprecationInstanceCheck class.
2015-09-23Refs #22933 -- Removed template.resolve_variable() per deprecation timeline.Tim Graham
2015-06-27Sorted imports in __init__.py files.Tim Graham
2015-06-24Renamed RemovedInDjangoXYWarnings for new roadmap.Tim Graham
Forwardport of ae1d663b7913f6da233c55409c4973248372d302 from stable/1.8.x plus more.
2015-05-21Fixed #17085, #24783 -- Refactored template library registration.Preston Timmons
* Converted the ``libraries`` and ``builtins`` globals of ``django.template.base`` into properties of the Engine class. * Added a public API for explicit registration of libraries and builtins.
2015-05-06Moved engine-related exceptions to django.template.exceptions.Preston Timmons
With the introduction of multiple template engines these exceptions are no longer DTL-specific. It makes more sense for them to be moved out of DTL-related modules.
2015-04-22Fixed #15053 -- Enabled recursive template loading.Preston Timmons
2015-02-06Fixed E265 comment styleCollin Anderson
2015-01-17Fixed typo in 'Django Template Language'David Robles
2015-01-07Exposed Engine in the django.template namespace.Aymeric Augustin
It's the main entrypoint to the refactored template system.
2014-12-28Explained the structure of django.template.Aymeric Augustin
2014-12-28Added initial support for loading template engines.Aymeric Augustin
2014-12-28Cleaned up the django.template namespace.Aymeric Augustin
Since this package is going to hold both the implementation of the Django Template Language and the infrastructure for Multiple Template Engines, it should be untied from the DTL as much as possible within our backwards-compatibility policy. Only public APIs (i.e. APIs mentioned in the documentation) were left.
2014-11-23Move compile_string into the Engine class.Aymeric Augustin
2014-10-04Fixed comment typo in django/template/__init__.pyMartin Matusiak
2013-11-02Fixed #21302 -- Fixed unused imports and import *.Tim Graham
2010-11-27Fixed #12248 -- Refactored django.template to get code out of __init__.py, ↵Russell Keith-Magee
to help with avoiding circular import dependencies. Thanks to Tom Tobin for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14722 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-11-17Fixed #10004 and #12320 -- Enabled the makemessages management command to ↵Jannis Leidel
collect comments for translators that start with the "Translators" keyword. Thanks for the report and patches, martinb and Claude Paroz. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14595 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-10-29Fixed #14181 -- Added a template tag and filters to allow localization to be ↵Russell Keith-Magee
disabled in a template. Thanks to Benjamin Wohlwend for the work on the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@14395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-15Fixed #13334: Restored ability to load template tags from eggs. Again thanks ↵Karen Tracey
Ramiro and metzen for pointers on how to find out if a module loaded from an egg has a particular submodule, and Russ for review. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12986 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-04-11Fixed #13311 -- Modified the tag library import process so it doesn't mask ↵Russell Keith-Magee
import errors in the tag library itself. Thanks to amccurdy for the report, and Alex Gaynor for the suggested fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-22Fixed #12554 again: Corrected regression in silencing attribute lookups ↵Karen Tracey
introduced in r12823, plus added a test for this so it doesn't regress again. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12834 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-20Fixed #12554: Silence exceptions that have specified ↵Karen Tracey
silent_variable_failure=True. Thanks Thomas Steinacher, copelco, mlavin. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-08Fixed #11461: Ensured complete traceback is available on the debug page when ↵Karen Tracey
an exception is encountered during template rendering, even when running on Python 2.6 or higher. Thanks Glenn. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12725 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-02Fixed #6510 -- Refactored the way child nodes are found in template nodes to ↵Russell Keith-Magee
avoid potential inconsistencies. Thanks to SmileyChris for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12654 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-03-01Fixed #12992: Adjusted the new template loader code so that the templateKaren Tracey
file name is correctly reported on the debug page when a template syntax error is raised. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12643 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-27Fixed #12981 -- Removed some stray tabs. Thanks to loewis for the report.Russell Keith-Magee
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-23Fixed #12070. Fixed a case where var._whatever wasn't raising a ↵Joseph Kocherhans
TemplateSyntaxError. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12539 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21Fixed #5972 - Allow the template filters to be used with the trans tag. ↵Jannis Leidel
Thanks for the initial patch, Dmitri Fedortchenko. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12472 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21Fixed #5971 - Fixed inconsistent behaviour of the TokenParser when parsing ↵Jannis Leidel
filters that follow constant strings or variables. Thanks Dmitri Fedortchenko, Adam Vandenberg and Ramiro Morales. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-02-21Fixed #7876 - Improved template error message to include expected end tag. ↵Jannis Leidel
Thanks to Matthias Kestenholz for the initial patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12460 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2010-01-26Fixed #6587 -- Removed nasty __path__ hacking in templatetag loading. Thanks ↵Russell Keith-Magee
to Øyvind Satvik and Andrew Badr for their work on this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-22Fixed #7980 - Improved i18n framework to support locale aware formatting ↵Jannis Leidel
(dates and numbers) and form processing. Thanks to Marc Garcia for working on this during his Google Summer of Code 2009! Additionally fixes #1061, #2203, #3940, #5526, #6449, #6231, #6693, #6783, #9366 and #10891. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11964 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-12-14Fixed #6262 -- Added a cached template loader, and modified existing ↵Russell Keith-Magee
template loaders and tag to be cacheable. Thanks to Mike Malone for the patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11862 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-10-27Fixed #12095 - login and other contrib views failing if template rendered ↵Luke Plant
using inclusion tag. The {% csrf_token %} tag is unable to get its value if a template is rendered using an inclusion_tag, since that creates a brand new Context, rather than using the existing one. Since this is a common pattern, and we need CSRF protection to be as simple and easy as possible, we special case the csrf_token and copy it from the parent context to the new context. A more elegant and general solution may appear in future, but this is good enough for now. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11672 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11Fixed #10369 -- Fixed auto-escaping inside "tran" and "blocktrans" tags.Malcolm Tredinnick
Patch from Andrew Badr. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10519 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10Fixed #9315 -- Handle spaces in URL tag arguments.Malcolm Tredinnick
Thanks Natalia Bidart and Matías Bordese for most of this patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-25Template filters now pass numerical arguments through as numbers.Malcolm Tredinnick
This was the (undocumented) behaviour prior to r10118 and now it's back again. It's neither hard nor harmful to maintain compatibility with the old ways. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-23Added consistent support for double- and single-quote delimiters in templates.Malcolm Tredinnick
Some template filters and tags understood single-quoted arguments, others didn't. This makes everything consistent. Based on a patch from akaihola. Fixed #7295. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10118 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-18Fixed #8193: all dynamic imports in Django are now done correctly. I know ↵Jacob Kaplan-Moss
this because Brett Cannon borrowed the time machine and brought Python 2.7's '`importlib` back for inclusion in Django. Thanks for the patch-from-the-future, Brett! git-svn-id: http://code.djangoproject.com/svn/django/trunk@10088 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16Fixed #10014 -- Don't crash when using debug template tag inside a block ↵Malcolm Tredinnick
node tag. Returning non-ASCII characters from TextNode.__repr__ was causing problems in the BlockNode.__repr__ method (and probably in other places we don't know about yet). We now forcibly convert to ascii and replace any unconvertible characters, rather than returning some moderately corrupted data in the non-ASCII case. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9757 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-31Fixed #7027: template tags now corectly break tokens around strings marked ↵Jacob Kaplan-Moss
for translation. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8769 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-08-15Fixed #5270 -- Allow template tags and filters to accept an emtpy string, ↵Gary Wilson Jr
patch from jdunck. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8393 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-06-06Fixed #7293 -- Corrected some doctests strings internal to the template ↵Russell Keith-Magee
module. Thanks, akaihola. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7580 bcc190cf-cafb-0310-a4f2-bffc1f526a37