﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33611	Allow View subclasses to define async method handlers.	Carlton Gibson	Carlton Gibson	"The current [https://docs.djangoproject.com/en/4.0/topics/async/#async-views topic docs for Async views] say this about class-based views: 

> For a class-based view, this means making its `__call__()` method an async def (not its `__init__()` or `as_view()`).

This isn't really appropriate for Django's class-based views: 

* We don't implement `__call__()`, rather going via `as_view()` — for a per-request instance — and then `dispatch()`. 
* Users expect to implement the HTTP method handlers — `get()`, `post()`, and so on — rather than these ''more internal'' bits. 

Ideally we'd allow specifying `async def` at the method handler level, to allow using `await` in the handler, and writing views such as this:

{{{
    import asyncio
    from django.http import HttpResponse
    from django.views import View

    class AsyncView(View):
        async def get(self, request, *args, **kwargs):
            # Perform io-blocking view-logic using await, sleep for example.
            await asyncio.sleep(1)
            return HttpResponse(""Hello async world!"")
}}}
"	New feature	closed	Generic views	4.0	Normal	fixed	async, asgi, views	Andrew Godwin	Ready for checkin	1	0	0	0	0	0
