feat: mpointstat手动录入在create时校验唯一
This commit is contained in:
parent
d5b5014bf9
commit
69e75cc1d7
|
@ -75,6 +75,11 @@ class MpointStatSerializer(CustomModelSerializer):
|
||||||
return False
|
return False
|
||||||
return True
|
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):
|
def validate(self, attrs):
|
||||||
mpoint = attrs["mpoint"]
|
mpoint = attrs["mpoint"]
|
||||||
if 'mgroup' not in attrs:
|
if 'mgroup' not in attrs:
|
||||||
|
|
Loading…
Reference in New Issue