fix
This commit is contained in:
@@ -156,15 +156,6 @@ class ProblemSerializer(BaseProblemSerializer):
|
|||||||
"answers",
|
"answers",
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_representation(self, instance):
|
|
||||||
data = super().to_representation(instance)
|
|
||||||
# 如果 allow_flowchart=False,则不返回 flowchart 相关字段
|
|
||||||
if not instance.allow_flowchart:
|
|
||||||
flowchart_fields = ['mermaid_code', 'flowchart_data', 'flowchart_hint', 'show_flowchart']
|
|
||||||
for field in flowchart_fields:
|
|
||||||
data.pop(field, None)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
class ProblemListSerializer(BaseProblemSerializer):
|
class ProblemListSerializer(BaseProblemSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -182,15 +173,6 @@ class ProblemListSerializer(BaseProblemSerializer):
|
|||||||
"rule_type",
|
"rule_type",
|
||||||
]
|
]
|
||||||
|
|
||||||
def to_representation(self, instance):
|
|
||||||
data = super().to_representation(instance)
|
|
||||||
# 如果 allow_flowchart=False,则不返回 flowchart 相关字段
|
|
||||||
if not instance.allow_flowchart:
|
|
||||||
flowchart_fields = ['mermaid_code', 'flowchart_data', 'flowchart_hint', 'show_flowchart']
|
|
||||||
for field in flowchart_fields:
|
|
||||||
data.pop(field, None)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
class ProblemSafeSerializer(BaseProblemSerializer):
|
class ProblemSafeSerializer(BaseProblemSerializer):
|
||||||
template = serializers.SerializerMethodField("get_public_template")
|
template = serializers.SerializerMethodField("get_public_template")
|
||||||
@@ -209,16 +191,6 @@ class ProblemSafeSerializer(BaseProblemSerializer):
|
|||||||
"answers",
|
"answers",
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_representation(self, instance):
|
|
||||||
data = super().to_representation(instance)
|
|
||||||
# 如果 allow_flowchart=False,则不返回 flowchart 相关字段
|
|
||||||
if not instance.allow_flowchart:
|
|
||||||
flowchart_fields = ['mermaid_code', 'flowchart_data', 'flowchart_hint', 'show_flowchart']
|
|
||||||
for field in flowchart_fields:
|
|
||||||
data.pop(field, None)
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
class ContestProblemMakePublicSerializer(serializers.Serializer):
|
class ContestProblemMakePublicSerializer(serializers.Serializer):
|
||||||
id = serializers.IntegerField()
|
id = serializers.IntegerField()
|
||||||
display_id = serializers.CharField(max_length=32)
|
display_id = serializers.CharField(max_length=32)
|
||||||
|
|||||||
Reference in New Issue
Block a user