#36872: Django's template engine cannot handle asynchronous methods
-------------------------------------+-------------------------------------
Reporter: Ricardo Robles | Owner: Ricardo
| Robles
Type: New feature | Status: closed
Component: Template system | Version: 6.0
Severity: Normal | Resolution: wontfix
Keywords: Template, Async | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Ricardo Robles):
Replying to [comment:12 Carlton Gibson]:
> As small as the change is here, I can't help but thinking it makes
little sense. Async functions just aren't supported in the DTL... and what
purpose do they serve? Adding this auto-wrap in async_to_sync is a road to
where exactly? Nowhere. It's a very short cul-de-sac.
>
> > I don't think anyone wants the current behavior with the memory
address of the coroutine rendered into the template (and RuntimeWarning at
shutdown for a coroutine not awaited).
>
> If this is a genuine problem (which I'm not sure it is: "Just don't do
that" is often enough) raising an error here would be better. It's not
making a misleading promise that we won't later keep.
>
> 🤷
Good morning, the inability to use asynchronous methods in DTL is a real
problem.
There are increasingly more asynchronous libraries that don't require
additional code to convert them to synchronous functionality for use in a
template.
For example, Django 6.0 introduced AsyncPaginator, which cannot be used in
DTL. Why did you add AsyncPaginator if you're not going to allow its use
in DTL?
--
Ticket URL: <https://code.djangoproject.com/ticket/36872#comment:15>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019bef19fbbc-4598d0e7-8338-4403-8905-0473be33b4ba-000000%40eu-central-1.amazonses.com.