From b62f6a8c28f53f969be04b9cad327d7791b57b60 Mon Sep 17 00:00:00 2001 From: Steven Bal Date: Tue, 7 Jan 2025 12:24:41 +0100 Subject: [PATCH] :sparkles: [#4991] Add selection of Referentielijsten services to general config the selected services will be shown as options when configuring select/selectboxes using Referentielijsten --- src/openforms/config/admin.py | 11 ++++++++- ...onfiguration_referentielijsten_services.py | 24 +++++++++++++++++++ src/openforms/config/models/config.py | 12 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/openforms/config/migrations/0056_globalconfiguration_referentielijsten_services.py diff --git a/src/openforms/config/admin.py b/src/openforms/config/admin.py index 7a8bb08a8d..1f49dc6544 100644 --- a/src/openforms/config/admin.py +++ b/src/openforms/config/admin.py @@ -161,7 +161,15 @@ class GlobalConfigurationAdmin(TranslationAdmin, SingletonModelAdmin): }, ), (_("Search engines"), {"fields": ("allow_indexing_form_detail",)}), - (_("Plugin configuration"), {"fields": ("plugin_configuration",)}), + ( + _("Plugin configuration"), + { + "fields": ( + "plugin_configuration", + "referentielijsten_services", + ) + }, + ), ( _("Registration"), { @@ -198,6 +206,7 @@ class GlobalConfigurationAdmin(TranslationAdmin, SingletonModelAdmin): ), ) readonly_fields = ("feature_flags_link",) + filter_horizontal = ("referentielijsten_services",) @admin.display(description=_("feature flags")) def feature_flags_link(self, obj) -> str: diff --git a/src/openforms/config/migrations/0056_globalconfiguration_referentielijsten_services.py b/src/openforms/config/migrations/0056_globalconfiguration_referentielijsten_services.py new file mode 100644 index 0000000000..a2d137abdb --- /dev/null +++ b/src/openforms/config/migrations/0056_globalconfiguration_referentielijsten_services.py @@ -0,0 +1,24 @@ +# Generated by Django 4.2.17 on 2025-01-13 10:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("zgw_consumers", "0022_set_default_service_slug"), + ("config", "0055_v270_to_v300"), + ] + + operations = [ + migrations.AddField( + model_name="globalconfiguration", + name="referentielijsten_services", + field=models.ManyToManyField( + blank=True, + help_text="List of services that are instances of the Referentielijsten API. The selected services will be shown as options when configuring select or selectboxes components to be populated from Referentielijsten.", + to="zgw_consumers.service", + verbose_name="referentielijsten services", + ), + ), + ] diff --git a/src/openforms/config/models/config.py b/src/openforms/config/models/config.py index 8fc8020418..baca1aa8ab 100644 --- a/src/openforms/config/models/config.py +++ b/src/openforms/config/models/config.py @@ -13,6 +13,7 @@ from glom import glom from solo.models import SingletonModel from tinymce.models import HTMLField +from zgw_consumers.models import Service from openforms.data_removal.constants import RemovalMethods from openforms.emails.validators import URLSanitationValidator @@ -558,6 +559,17 @@ class GlobalConfiguration(SingletonModel): ), ) + referentielijsten_services = models.ManyToManyField( + Service, + verbose_name=_("referentielijsten services"), + help_text=_( + "List of services that are instances of the Referentielijsten API. " + "The selected services will be shown as options when configuring " + "select or selectboxes components to be populated from Referentielijsten." + ), + blank=True, + ) + # search engine configuration allow_indexing_form_detail = models.BooleanField( _("Allow form page indexing"),