From 6465f8fab2cea900864148ebf1549c6b8c421e70 Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Tue, 14 Oct 2025 21:30:44 +0800 Subject: [PATCH] add sort --- problem/views/oj.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/problem/views/oj.py b/problem/views/oj.py index caf8a68..c4b7413 100644 --- a/problem/views/oj.py +++ b/problem/views/oj.py @@ -106,6 +106,11 @@ class ProblemAPI(APIView): if difficulty: problems = problems.filter(difficulty=difficulty) + # 排序 + sort = request.GET.get("sort") + if sort: + problems = problems.order_by(sort) + # 根据profile 为做过的题目添加标记 data = self.paginate_data(request, problems, ProblemListSerializer) self._add_problem_status(request, data)