[Django] #36817: Possible regression of Engine.get_template

8 views
Skip to first unread message

Django

unread,
Dec 22, 2025, 3:53:11 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Type: Bug
Hansen | Component: Template
Status: new | system
Version: 6.0 | 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
-------------------------------------+-------------------------------------
While trying to upgrade to Django 6.0 locally today, we noticed an issue
with one of our third party packages, adminsortable2.

For their admin templates, they use Path objects: https://github.com/jrief
/django-admin-sortable2/blob/master/adminsortable2/admin.py#L124

This has worked until this commit
https://github.com/django/django/commit/5e06b970956af4854e970e74990cb971ba31c96b
where get_template was refactored to support Template Partials.

As a by-product, template names now have to be strings.

I don't see that it was ever mentioned/officially supported, to use Path
objects for templates, but I would suspect that several third party
libraries does this, and I would therefore see this as a regression.

If this is deemed not to be the case, I'll create an issue on their Github
to change the behaviour.
--
Ticket URL: <https://code.djangoproject.com/ticket/36817>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 22, 2025, 3:55:06 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: (none)
Hansen |
Type: Bug | Status: new
Component: Template system | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Henrik Ossipoff Hansen):

{{{
TypeError at /admin/terminals/terminal/
sequence item 0: expected str instance, PosixPath found
Request Method: GET
Request URL: http://localhost:8000/admin/terminals/terminal/
Django Version: 6.0
Exception Type: TypeError
Exception Value:
sequence item 0: expected str instance, PosixPath found
Exception Location: /usr/local/lib/python3.14/site-
packages/django/template/loader.py, line 47, in select_template
Raised during: adminsortable2.admin.changelist_view
Python Executable: /usr/local/bin/python
Python Version: 3.14.2
Python Path:
['/code',
'/code',
'/usr/local/lib/python314.zip',
'/usr/local/lib/python3.14',
'/usr/local/lib/python3.14/lib-dynload',
'/usr/local/lib/python3.14/site-packages']
Server time: Mon, 22 Dec 2025 08:54:07 +0000
Traceback Switch to copy-and-paste view
/usr/local/lib/python3.14/site-packages/django/core/handlers/exception.py,
line 55, in inner
response = get_response(request)
^^^^^^^^^^^^^^^^^^^^^ …
Local vars
/usr/local/lib/python3.14/site-packages/django/core/handlers/base.py, line
221, in _get_response
response = response.render()
^^^^^^^^^^^^^^^^^ …
Local vars
/usr/local/lib/python3.14/site-packages/django/template/response.py, line
114, in render
self.content = self.rendered_content
^^^^^^^^^^^^^^^^^^^^^ …
Local vars
/usr/local/lib/python3.14/site-packages/django/template/response.py, line
90, in rendered_content
template = self.resolve_template(self.template_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ …
Local vars
/usr/local/lib/python3.14/site-packages/django/template/response.py, line
72, in resolve_template
return select_template(template, using=self.using)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ …
Local vars
/usr/local/lib/python3.14/site-packages/django/template/loader.py, line
47, in select_template
raise TemplateDoesNotExist(", ".join(template_name_list),
chain=chain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ …
Local vars
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:1>

Django

unread,
Dec 22, 2025, 5:01:21 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: (none)
Hansen |
Type: Bug | Status: new
Component: Template system | Version: 6.0
Severity: Release blocker | 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 Carlton Gibson):

* cc: Carlton Gibson (added)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted

Comment:

Yes… OK. The DTL loader always expected strings, but they're always meant
to be paths, so Path objects seem a reasonable thing to allow.

Checking if `template_name` is a `Path` and converting back to a string in
`get_template()` should be acceptable.

Want to make a PR Henrik?
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:2>

Django

unread,
Dec 22, 2025, 5:29:19 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: Varun
Hansen | Kasyap Pentamaraju
Type: Bug | Status: assigned
Component: Template system | Version: 6.0
Severity: Release blocker | 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 Varun Kasyap Pentamaraju):

* owner: (none) => Varun Kasyap Pentamaraju
* status: new => assigned

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

Django

unread,
Dec 22, 2025, 5:32:51 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: Varun
Hansen | Kasyap Pentamaraju
Type: Bug | Status: assigned
Component: Template system | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Henrik Ossipoff Hansen):

Can see Varun assigned themselves, so I'll let them handle it - if not
I'll gladly make quick-fix.
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:4>

Django

unread,
Dec 22, 2025, 7:03:03 AM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: Varun
Hansen | Kasyap Pentamaraju
Type: Bug | Status: assigned
Component: Template system | Version: 6.0
Severity: Release blocker | 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 Varun Kasyap Pentamaraju):

* has_patch: 0 => 1

Comment:

Thanks Henrik,

Created Patch: https://github.com/django/django/pull/20442
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:5>

Django

unread,
Dec 22, 2025, 3:02:11 PM12/22/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: Varun
Hansen | Kasyap Pentamaraju
Type: Bug | Status: closed
Component: Template system | Version: 6.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 1 => 0
* resolution: => duplicate
* severity: Release blocker => Normal
* stage: Accepted => Unreviewed
* status: assigned => closed

Comment:

Thanks, but this was wontfixed in #36817. The provided patch doesn't
account for the jinja2 loader, for example, so we shouldn't suggest this
is supported.

> For their admin templates, they use Path objects:

Are you sure you haven't updated to a more recent version of that package?
The source you linked to shows this was already fixed there.
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:6>

Django

unread,
Dec 23, 2025, 3:46:18 AM12/23/25
to django-...@googlegroups.com
#36817: Possible regression of Engine.get_template
-------------------------------------+-------------------------------------
Reporter: Henrik Ossipoff | Owner: Varun
Hansen | Kasyap Pentamaraju
Type: Bug | Status: closed
Component: Template system | Version: 6.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Carlton Gibson):

Yep, I'd forgotten about that one. Thanks, Jacob.
--
Ticket URL: <https://code.djangoproject.com/ticket/36817#comment:7>
Reply all
Reply to author
Forward
0 new messages