style: ruff format 全仓库
行宽 180 下把历史遗留的折行表达式合并,无语义改动。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -53,19 +53,10 @@ class TutorialAdminAPI(APIView):
|
||||
return self.success(TutorialSerializer(tutorial).data)
|
||||
except Tutorial.DoesNotExist:
|
||||
return self.error("Tutorial does not exist")
|
||||
|
||||
|
||||
tutorials = Tutorial.objects.all().order_by("order", "-created_at")
|
||||
# 按 type 分组返回数据
|
||||
result = {
|
||||
"python": TutorialListSerializer(
|
||||
tutorials.filter(type="python"),
|
||||
many=True
|
||||
).data,
|
||||
"c": TutorialListSerializer(
|
||||
tutorials.filter(type="c"),
|
||||
many=True
|
||||
).data
|
||||
}
|
||||
result = {"python": TutorialListSerializer(tutorials.filter(type="python"), many=True).data, "c": TutorialListSerializer(tutorials.filter(type="c"), many=True).data}
|
||||
return self.success(result)
|
||||
|
||||
@super_admin_required
|
||||
|
||||
@@ -16,9 +16,7 @@ class TutorialAPI(APIView):
|
||||
class TutorialTitlesAPI(APIView):
|
||||
def get(self, request):
|
||||
type = request.GET.get("type") or "python"
|
||||
tutorials = Tutorial.objects.filter(is_public=True, type=type).values(
|
||||
"id", "title"
|
||||
)
|
||||
tutorials = Tutorial.objects.filter(is_public=True, type=type).values("id", "title")
|
||||
return self.success(list(tutorials))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user