﻿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
35615	Add ability to render request.user in templates when async is used	amirreza	GunSliger00007	"during testing django's async support i got an error when trying to use the `user` context usually available in django's templates
since this context makes database calls using the sync methods from the ORM, using it while an ASGI is used would throw an exception.

`pat` who is a mod in django's discord server pointed that an `auser` exists that can be used but looking in the code-base i found that using this would be painful since it is a coroutine object, and django's template (as far as i know) can't await on coroutins

so i have to await on `request.auser` on view and pass the result as context

but since usually request.user is is used in more than one page, on a normal blog project we might be awaiting on `auser` in all of the views, i made some modifications to `django.contrib.auth.AuthenticationMiddleware` and `django.utils.deprecation.MiddlewareMixin` to ease the job.

i hope the PR will show fruitful for the django community.

it is worth noting that no actual logic was needed for this and this is done by pretty much moving around soe of the existing code
also the existing tests for the middleware apply to the new code by a small modification."	New feature	assigned	Template system	5.0	Normal		async,render	amirreza Dingning Jon Janzen Andrew Godwin	Accepted	0	0	0	0	0	0
