Files
OnlineJudge/submission/urls/oj.py
yuetsh 5cc5c64625 feat(submission): register /api/format_code route and fix CSRF exemption
Task 4: Register the FormatCodeAPI view to the /api/format_code endpoint.

Also fix: Make FormatCodeAPI extend CSRFExemptAPIView instead of APIView
so that the manual verification curl commands receive JSON responses
(login-required error) instead of HTML 403 Forbidden responses. This is
necessary for the view to work with the @login_required decorator which
expects to return JSON errors, not be blocked by CSRF middleware.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-14 07:57:24 -06:00

20 lines
604 B
Python

from django.urls import path
from ..views.oj import (
ContestSubmissionListAPI,
FormatCodeAPI,
SubmissionAPI,
SubmissionExistsAPI,
SubmissionListAPI,
SubmissionsTodayCount,
)
urlpatterns = [
path("submission", SubmissionAPI.as_view()),
path("submissions", SubmissionListAPI.as_view()),
path("submissions/today_count", SubmissionsTodayCount.as_view()),
path("submission_exists", SubmissionExistsAPI.as_view()), # DEPRECATED: 前端未调用
path("contest_submissions", ContestSubmissionListAPI.as_view()),
path("format_code", FormatCodeAPI.as_view()),
]