feat: mpointstat手动录入在create时校验唯一
This commit is contained in:
parent
d5b5014bf9
commit
69e75cc1d7
|
@ -74,6 +74,11 @@ class MpointStatSerializer(CustomModelSerializer):
|
|||
if key not in dictionary or not dictionary[key]:
|
||||
return False
|
||||
return True
|
||||
|
||||
def create(self, validated_data):
|
||||
if MpointStat.objects.filter(mpoint=validated_data["mpoint"], sflog=validated_data["sflog"]).exists():
|
||||
raise ParseError("该数据已录入")
|
||||
return super().create(validated_data)
|
||||
|
||||
def validate(self, attrs):
|
||||
mpoint = attrs["mpoint"]
|
||||
|
|
Loading…
Reference in New Issue