From 5c350cb657131f147da73e4553f30b8fd16bb462 Mon Sep 17 00:00:00 2001 From: Viktor van Wijk Date: Tue, 17 Dec 2024 12:15:34 +0100 Subject: [PATCH] :truck: [#4908] Rename plugin Plugin name did not make sense before --- src/openforms/conf/base.py | 2 +- .../contrib/{new_plugin => json}/__init__.py | 0 src/openforms/registrations/contrib/json/apps.py | 12 ++++++++++++ .../contrib/{new_plugin => json}/config.py | 2 +- .../contrib/{new_plugin => json}/plugin.py | 8 ++++---- .../registrations/contrib/new_plugin/apps.py | 12 ------------ 6 files changed, 18 insertions(+), 18 deletions(-) rename src/openforms/registrations/contrib/{new_plugin => json}/__init__.py (100%) create mode 100644 src/openforms/registrations/contrib/json/apps.py rename src/openforms/registrations/contrib/{new_plugin => json}/config.py (94%) rename src/openforms/registrations/contrib/{new_plugin => json}/plugin.py (74%) delete mode 100644 src/openforms/registrations/contrib/new_plugin/apps.py diff --git a/src/openforms/conf/base.py b/src/openforms/conf/base.py index 737bba1058..7656920ee9 100644 --- a/src/openforms/conf/base.py +++ b/src/openforms/conf/base.py @@ -224,7 +224,7 @@ "openforms.registrations.contrib.objects_api", "openforms.registrations.contrib.microsoft_graph.apps.MicrosoftGraphApp", "openforms.registrations.contrib.camunda.apps.CamundaApp", - "openforms.registrations.contrib.new_plugin", + "openforms.registrations.contrib.json", "openforms.prefill", "openforms.prefill.contrib.demo.apps.DemoApp", "openforms.prefill.contrib.kvk.apps.KVKPrefillApp", diff --git a/src/openforms/registrations/contrib/new_plugin/__init__.py b/src/openforms/registrations/contrib/json/__init__.py similarity index 100% rename from src/openforms/registrations/contrib/new_plugin/__init__.py rename to src/openforms/registrations/contrib/json/__init__.py diff --git a/src/openforms/registrations/contrib/json/apps.py b/src/openforms/registrations/contrib/json/apps.py new file mode 100644 index 0000000000..533f478116 --- /dev/null +++ b/src/openforms/registrations/contrib/json/apps.py @@ -0,0 +1,12 @@ +from django.apps import AppConfig +from django.utils.translation import gettext_lazy as _ + + +# TODO-4098: maybe rename to FVaJ (Form Variables as JSON) +class JSONConfig(AppConfig): + name = "openforms.registrations.contrib.json" + label = "registrations_json" + verbose_name = _("JSON plugin") + + def ready(self): + from . import plugin # noqa diff --git a/src/openforms/registrations/contrib/new_plugin/config.py b/src/openforms/registrations/contrib/json/config.py similarity index 94% rename from src/openforms/registrations/contrib/new_plugin/config.py rename to src/openforms/registrations/contrib/json/config.py index 48d26487fa..4ddc4f06a2 100644 --- a/src/openforms/registrations/contrib/new_plugin/config.py +++ b/src/openforms/registrations/contrib/json/config.py @@ -8,7 +8,7 @@ from openforms.utils.mixins import JsonSchemaSerializerMixin -class NewPluginOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serializer): +class JSONOptionsSerializer(JsonSchemaSerializerMixin, serializers.Serializer): # TODO-4098: is service enough, or do we need an API group like the ObjectsAPI? service = PrimaryKeyRelatedAsChoicesField( queryset=Service.objects.all(), diff --git a/src/openforms/registrations/contrib/new_plugin/plugin.py b/src/openforms/registrations/contrib/json/plugin.py similarity index 74% rename from src/openforms/registrations/contrib/new_plugin/plugin.py rename to src/openforms/registrations/contrib/json/plugin.py index d729e032da..2d97154fdb 100644 --- a/src/openforms/registrations/contrib/new_plugin/plugin.py +++ b/src/openforms/registrations/contrib/json/plugin.py @@ -3,13 +3,13 @@ from openforms.submissions.models import Submission from ...base import BasePlugin, OptionsT # openforms.registrations.base from ...registry import register # openforms.registrations.registry -from .config import NewPluginOptionsSerializer +from .config import JSONOptionsSerializer -@register("new_plugin") -class NewPlugin(BasePlugin): +@register("json") +class JSONPlugin(BasePlugin): verbose_name = _("New fancy plugin") - configuration_options = NewPluginOptionsSerializer + configuration_options = JSONOptionsSerializer def register_submission(self, submission: Submission, options: OptionsT) -> None: print(options) diff --git a/src/openforms/registrations/contrib/new_plugin/apps.py b/src/openforms/registrations/contrib/new_plugin/apps.py deleted file mode 100644 index 70b007c941..0000000000 --- a/src/openforms/registrations/contrib/new_plugin/apps.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.apps import AppConfig -from django.utils.translation import gettext_lazy as _ - - -# TODO-4908: come up with good name: 'JSON' or '(Form) Variables API'? -class NewPluginConfig(AppConfig): - name = "openforms.registrations.contrib.new_plugin" - label = "registrations_new_plugin" - verbose_name = _("New plugin") - - def ready(self): - from . import plugin # noqa