mirror of
https://github.com/QingdaoU/OpenVJ.git
synced 2024-12-28 15:31:48 +00:00
增加处理submission的serializer
This commit is contained in:
parent
e1e887b5d6
commit
2948d0c9e0
@ -4,7 +4,7 @@ import json
|
||||
from rest_framework import serializers
|
||||
|
||||
from robots.utils import Language
|
||||
from .models import Problem
|
||||
from .models import Problem, Submission
|
||||
|
||||
|
||||
class JSONField(serializers.Field):
|
||||
@ -22,4 +22,12 @@ class ProblemSerializer(serializers.ModelSerializer):
|
||||
class CreateSubmissionSerializer(serializers.Serializer):
|
||||
problem_id = serializers.CharField(max_length=32)
|
||||
language = serializers.ChoiceField(choices=[Language.C, Language.CPP, Language.Java])
|
||||
code = serializers.CharField(max_length=10000)
|
||||
code = serializers.CharField(max_length=10000)
|
||||
|
||||
|
||||
class SubmissionSerializer(serializers.ModelSerializer):
|
||||
info = JSONField()
|
||||
|
||||
class Meta:
|
||||
model = Submission
|
||||
exclude = ["submit_task_id", "task_id", "robot_user", "origin_submission_id", "api_key"]
|
Loading…
Reference in New Issue
Block a user