#37124: AccessMixin: object HttpResponseRedirect can't be used in 'await'
expression
--------------------------------+-----------------------------------------
Reporter: Johannes Maron | Type: Bug
Status: new | Component: Uncategorized
Version: dev | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------+-----------------------------------------
The redirect response in AccessMixin.handle_no_permission isn't async
compatible.
If you have access, everything works fine, since all HTTP method handlers
are async and return coroutines; only if you lack permissions or are
unauthenticated is the redirect response synchronous.
With access to `view_is_async` it should be a fairly easy fix to have
`handle_no_permission` return a coroutine.
Thanks to @amirreza-sf80 for reporting:
https://github.com/django/new-features/issues/162#issuecomment-4562082172
I could find the bug on Stack Overflow as well, but no ticket on Trac:
https://stackoverflow.com/questions/66512353/using-loginrequiredmixin-
with-async-views
--
Ticket URL: <
https://code.djangoproject.com/ticket/37124>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.