feat: ADRF async views (phase1) + native async serializers (phase2) + async cache infra

This commit is contained in:
async-upgrade
2026-09-06 14:26:17 +08:00
parent 9a6577f71e
commit 8f488fcaaa
55 changed files with 2224 additions and 1513 deletions
+4 -3
View File
@@ -1,5 +1,5 @@
from rest_framework.permissions import AllowAny
from rest_framework.views import APIView
from adrf.views import APIView
from rest_framework.response import Response
from rest_framework import status
from drf_yasg.utils import swagger_auto_schema
@@ -59,7 +59,7 @@ class RegionListView(APIView):
),
}
)
def get(self, request):
async def get(self, request):
level = request.GET.get('level')
parent_code = request.GET.get('parent_code')
@@ -78,7 +78,8 @@ class RegionListView(APIView):
else:
queryset = queryset.filter(level=1)
serializer = RegionSimpleSerializer(queryset, many=True)
regions = [r async for r in queryset]
serializer = RegionSimpleSerializer(regions, many=True)
return Response(
{"code": 200, "message": "success", "data": serializer.data},
status=status.HTTP_200_OK