[Django] #36410: Add named template partials to the DTL.

24 views
Skip to first unread message

Django

unread,
May 23, 2025, 5:55:26 AMMay 23
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
-------------------------------------------+----------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+----------------------------
Completing the cycle begun in 2023, incorporate ''named template
partials'' into the Django Template Language.

Starting with the forum discussion on [https://forum.djangoproject.com/t
/adding-template-fragments-or-partials-for-the-dtl/21500 Adding template
fragments or partials for the DTL] we added the internal structures
necessary for template partials in #34883.

The third-party [https://github.com/carltongibson/django-template-partials
django-template-partials] package, first released during the Django 4.2
cycle, has battle-tested the implementation over a full LTS cycle, and
gained significant community uptake.

The project to merge this into Django was accepted for GSoC 2025, with
Farhan Ali Raza implementing it.

The project is to merge to the two template tags, for defining and
rendering a partial, plus the integration with template loader, so that
partial fragments can be loaded by name. A migration guide will be added
to the django-template-partials repo for existing users.
--
Ticket URL: <https://code.djangoproject.com/ticket/36410>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 23, 2025, 8:06:35 AMMay 23
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Sarah Boyce):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:1>

Django

unread,
Jul 16, 2025, 6:12:25 AMJul 16
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* cc: Farhan Ali (added)
* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:2>

Django

unread,
Jul 18, 2025, 10:48:56 AMJul 18
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:3>

Django

unread,
Jul 20, 2025, 2:31:00 PMJul 20
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0

Comment:

There are a couple of comments remaining about code moving. But it is not
clear what decision is made about those.
--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:4>

Django

unread,
Jul 21, 2025, 2:07:31 PMJul 21
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:5>

Django

unread,
Jul 23, 2025, 11:46:54 AMJul 23
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:6>

Django

unread,
Jul 30, 2025, 2:56:56 PMJul 30
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:7>

Django

unread,
Aug 1, 2025, 3:32:26 PMAug 1
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:8>

Django

unread,
Aug 6, 2025, 3:19:33 PMAug 6
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:9>

Django

unread,
Aug 9, 2025, 12:34:08 PMAug 9
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:10>

Django

unread,
Aug 9, 2025, 12:59:57 PMAug 9
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_tests: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:11>

Django

unread,
Aug 11, 2025, 4:32:20 PMAug 11
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Natalia Bidart):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:12>

Django

unread,
Aug 12, 2025, 11:18:19 AMAug 12
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
---------------------------------+--------------------------------------
Reporter: Carlton Gibson | Owner: Farhan Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Farhan Ali):

* needs_better_patch: 1 => 0

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:13>

Django

unread,
Aug 14, 2025, 8:52:04 AMAug 14
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
-------------------------------------+-------------------------------------
Reporter: Carlton Gibson | Owner: Farhan
| Ali
Type: New feature | Status: assigned
Component: Template system | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:14>

Django

unread,
Aug 14, 2025, 8:53:25 PMAug 14
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
-------------------------------------+-------------------------------------
Reporter: Carlton Gibson | Owner: Farhan
| Ali
Type: New feature | Status: closed
Component: Template system | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by nessita <124304+nessita@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"5e06b970956af4854e970e74990cb971ba31c96b" 5e06b970]:
{{{#!CommitTicketReference repository=""
revision="5e06b970956af4854e970e74990cb971ba31c96b"
Fixed #36410 -- Added support for Template Partials to the Django Template
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 <car...@noumenal.es>
Co-authored-by: Natalia <124304+...@users.noreply.github.com>
Co-authored-by: Nick Pope <ni...@nickpope.me.uk>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:15>

Django

unread,
Aug 18, 2025, 7:54:40 AMAug 18
to django-...@googlegroups.com
#36410: Add named template partials to the DTL.
-------------------------------------+-------------------------------------
Reporter: Carlton Gibson | Owner: Farhan
| Ali
Type: New feature | Status: closed
Component: Template system | Version: dev
Severity: Normal | Resolution: fixed
Keywords: partials | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* keywords: => partials

--
Ticket URL: <https://code.djangoproject.com/ticket/36410#comment:16>
Reply all
Reply to author
Forward
0 new messages