This commit is contained in:
yuetsh
2024-07-02 22:38:57 +08:00
parent 6356406b01
commit b397c4add2
2 changed files with 3 additions and 3 deletions

View File

@@ -9,14 +9,14 @@ class CommentAPI(APIView):
@super_admin_required
def get(self, request):
comments = Comment.objects.select_related("problem").exclude(content="")
problem_id = request.GET.get("problem_id")
problem_id = request.GET.get("problem")
if problem_id:
try:
# 这里如果题目不可见,也需要显示该题目的评论
problem = Problem.objects.get(_id=problem_id, contest_id__isnull=True)
except Problem.DoesNotExist:
return self.error("Problem doesn't exist")
comments = comments.filter(problem=problem)
comments = comments.filter(problem=problem)
return self.success(
self.paginate_data(request, comments, CommentListSerializer)
)

View File

@@ -16,5 +16,5 @@ urlpatterns = [
path("api/admin/", include("utils.urls")),
path("api/", include("message.urls.oj")),
path("api/", include("comment.urls.oj")),
path("api/admin", include("comment.urls.admin")),
path("api/admin/", include("comment.urls.admin")),
]