#36731: Allow TemplateView classes to have an asynchronous get_context_data method
-------------------------------------+-------------------------------------
Reporter: rrobles | Type: Bug
Status: new | Component: Template
| system
Version: 5.2 | Severity: Normal
Keywords: TemplateView, | Triage Stage:
get_context_data, async | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Currently, you can't use an asynchronous `get_context_data` in a
`TemplateView` because it throws the following error:
`TypeError: context must be a dict rather than a coroutine`.
I've proposed some changes in this Pull Request:
https://github.com/django/django/pull/20081
These changes include a check to see if the context is a coroutine so it
can be handled correctly in `make_context`. This allows you to handle
`get_context_data` correctly when it's asynchronous.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36731>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.