From 01f82ee46c47ec6ddf6c6d826968f2fd05bdf7a3 Mon Sep 17 00:00:00 2001 From: Daniel Mursa Date: Thu, 19 Dec 2024 16:58:04 +0100 Subject: [PATCH] [#233] Check boh --- .../klantinteracties/api/tests/test_partijen.py | 2 +- .../components/klantinteracties/models/partijen.py | 9 ++++++--- .../components/klantinteracties/models/validators.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/openklant/components/klantinteracties/api/tests/test_partijen.py b/src/openklant/components/klantinteracties/api/tests/test_partijen.py index aa3ad374..29fb3f52 100644 --- a/src/openklant/components/klantinteracties/api/tests/test_partijen.py +++ b/src/openklant/components/klantinteracties/api/tests/test_partijen.py @@ -1,6 +1,6 @@ import datetime -from rest_framework.serializers import ValidationError +from django.core.exceptions import ValidationError from django.utils.translation import gettext as _ from rest_framework import status diff --git a/src/openklant/components/klantinteracties/models/partijen.py b/src/openklant/components/klantinteracties/models/partijen.py index d3b04a48..1a8b4794 100644 --- a/src/openklant/components/klantinteracties/models/partijen.py +++ b/src/openklant/components/klantinteracties/models/partijen.py @@ -429,6 +429,9 @@ def clean(self): self.partij_identificator_code_soort_object_id, self.partij_identificator_object_id, ) - partij_validator.validate_code_object_type() - partij_validator.validate_code_soort_object_id() - partij_validator.validate_object_id() + try: + partij_validator.validate_code_object_type() + partij_validator.validate_code_soort_object_id() + partij_validator.validate_object_id() + except ValidationError as err: + raise ValidationError("eeeeeeeeeeeeeeeeeeeeeee") diff --git a/src/openklant/components/klantinteracties/models/validators.py b/src/openklant/components/klantinteracties/models/validators.py index 991a6ac2..cbc55b17 100644 --- a/src/openklant/components/klantinteracties/models/validators.py +++ b/src/openklant/components/klantinteracties/models/validators.py @@ -1,4 +1,4 @@ -from rest_framework.serializers import ValidationError +from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ from .constants import (