Does anyone have any examples on how I can make my DRF class based modelviews async? Reading the Django docs it says...
Any view can be declared async by making the callable part of it return a coroutine - commonly, this is done using async def. For a function-based view, this means declaring the whole view using async def. For a class-based view, this means making its call() method an async def (not its init() or as_view()).
I have class based views, so what I was hoping was there were examples on the correct syntax to implement the async on the call() method so that I can try and make my view async to make use of Django's async support. Now, there are examples of implementing an async view if it's a function based view, meaning making the as_view() for example async How to use async function based views in DRF?
Unfortunately, I haven't found any examples as of yet for implementing this for class based views.
Given this, I was also hoping there are examples of how I can unit test my new async class based views. I've been using APITestCase and unittest.mock to run and patch various tests on my sync views, but this doesn't support testing a coroutine, so the tests fail.
websocketsi dont know...