#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.
--
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/0107019e6db9013d-72013689-892f-4f3c-a81a-8ff29514cb99-000000%40eu-central-1.amazonses.com.