forked from github/plane
fix: module link create url validation (#678)
This commit is contained in:
parent
67952bc225
commit
d990f0038b
@ -139,6 +139,16 @@ class ModuleLinkSerializer(BaseSerializer):
|
|||||||
"module",
|
"module",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Validation if url already exists
|
||||||
|
def create(self, validated_data):
|
||||||
|
if ModuleLink.objects.filter(
|
||||||
|
url=validated_data.get("url"), module_id=validated_data.get("module_id")
|
||||||
|
).exists():
|
||||||
|
raise serializers.ValidationError(
|
||||||
|
{"error": "URL already exists for this Issue"}
|
||||||
|
)
|
||||||
|
return ModuleLink.objects.create(**validated_data)
|
||||||
|
|
||||||
|
|
||||||
class ModuleSerializer(BaseSerializer):
|
class ModuleSerializer(BaseSerializer):
|
||||||
project_detail = ProjectSerializer(read_only=True, source="project")
|
project_detail = ProjectSerializer(read_only=True, source="project")
|
||||||
|
Loading…
Reference in New Issue
Block a user