mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Merge branch 'enrico/async' of github.com:em1208/django-rest-framework into enrico/async
This commit is contained in:
commit
f16767f2e5
|
@ -225,13 +225,13 @@ For class based views, all handler methods must be async, otherwise Django will
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
class ListUsers(APIView):
|
class AsyncView(APIView):
|
||||||
async def get(self, request):
|
async def get(self, request):
|
||||||
return Response({"message": "This is an async class based view."})
|
return Response({"message": "This is an async class based view."})
|
||||||
|
|
||||||
|
|
||||||
@api_view(['GET'])
|
@api_view(['GET'])
|
||||||
async def view(request):
|
async def async_view(request):
|
||||||
return Response({"message": "This is an async function based view."})
|
return Response({"message": "This is an async function based view."})
|
||||||
|
|
||||||
[cite]: https://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html
|
[cite]: https://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html
|
||||||
|
|
Loading…
Reference in New Issue
Block a user