#35030: No async version of login_required
----------------------------------------+----------------------------------
               Reporter:  Mike Lissner  |          Owner:  nobody
                   Type:  New feature   |         Status:  new
              Component:  contrib.auth  |        Version:  dev
               Severity:  Normal        |       Keywords:  async, decorator
           Triage Stage:  Unreviewed    |      Has patch:  0
    Needs documentation:  0             |    Needs tests:  0
Patch needs improvement:  0             |  Easy pickings:  0
                  UI/UX:  0             |
----------------------------------------+----------------------------------
 We're slowly moving our code base over to async views and tests. Django
 5.0 is a big leap forward for this, but we've found that there's still no
 async version of the @login_required decorator.

 We're working around it with some funky decorator usage:


 {{{
 @sync_to_async
 @login_required
 @async_to_sync
 async def our_view(request):
 }}}

 Buuuut, it'd be great not to need to do all this and to either have an
 async version of login_required (@alogin_required, perhaps?) or for it to
 just work with async views.

 I don't think there's an open issue for this, but amusingly, in
 [https://code.djangoproject.com/ticket/31949#comment:27 a comment 11
 months ago],  Carlton Gibson touched on making login_required work with
 async, but he thought it'd take another five years. Perhaps we can do
 better. :)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35030>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018c5acdf2e7-ef58ad62-cdb8-4f45-8883-067db814aa1e-000000%40eu-central-1.amazonses.com.

Reply via email to