1
- from django .conf import settings
2
-
3
1
from django_setup_configuration import ConfigurationModel , DjangoModelRef
4
2
from django_setup_configuration .configuration import BaseConfigurationStep
5
3
from django_setup_configuration .exceptions import ConfigurationRunFailed
6
- from zgw_consumers .api_models .constants import VertrouwelijkheidsAanduidingen
7
4
from zgw_consumers .models import Service
8
5
6
+ from open_inwoner .configurations .bootstrap .utils import get_service
9
7
from open_inwoner .openzaak .models import OpenZaakConfig , ZGWApiGroupConfig
10
8
11
9
@@ -51,11 +49,6 @@ class ZGWAPIsConfigurationStep(BaseConfigurationStep):
51
49
namespace = "openzaak_config"
52
50
config_model = ZGWAPIsConfigurationModel
53
51
54
- # def is_configured(self) -> bool:
55
- # """Verify that at least 1 ZGW API set is configured."""
56
- # zgw_config = OpenZaakConfig.get_solo()
57
- # return ZGWApiGroupConfig.objects.filter(open_zaak_config=zgw_config).exists()
58
-
59
52
def execute (self , model : ZGWAPIsConfigurationModel ):
60
53
if len (model .api_groups ) < 1 :
61
54
raise ConfigurationRunFailed ("Configure at least one `api_groups` item" )
@@ -65,19 +58,19 @@ def execute(self, model: ZGWAPIsConfigurationModel):
65
58
for api_group in model .api_groups :
66
59
67
60
try :
68
- zrc_service = Service . objects . get (
69
- slug = api_group .zaken_api_identifier ,
61
+ zrc_service = get_service (
62
+ api_group .zaken_api_identifier ,
70
63
)
71
- ztc_service = Service . objects . get (
72
- slug = api_group .catalogi_api_identifier ,
64
+ ztc_service = get_service (
65
+ api_group .catalogi_api_identifier ,
73
66
)
74
- drc_service = Service . objects . get (
75
- slug = api_group .documenten_api_identifier ,
67
+ drc_service = get_service (
68
+ api_group .documenten_api_identifier ,
76
69
)
77
70
# Not required
78
71
form_service = (
79
- Service . objects . get (
80
- slug = api_group .form_api_identifier ,
72
+ get_service (
73
+ api_group .form_api_identifier ,
81
74
)
82
75
if api_group .form_api_identifier
83
76
else None
0 commit comments