Skip to content

Commit

Permalink
🚚 [#1068] -- move npFamilyMembers code into openforms.formio package
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Nov 24, 2022
1 parent 6b9dea1 commit cd46627
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 14 deletions.
3 changes: 2 additions & 1 deletion src/openforms/conf/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@
"openforms.config",
"openforms.emails",
"openforms.formio",
"openforms.formio.components.np_family_members",
"openforms.formio.rendering",
"openforms.forms",
"openforms.multidomain",
Expand Down Expand Up @@ -236,7 +237,7 @@
"openforms.utils",
"openforms.upgrades",
"openforms.plugins",
"openforms.custom_field_types",
"openforms.custom_field_types", # TODO: remove completely after 2.1 is released
# Apps registering static variables
"openforms.variables.static_variables.apps.StaticVariables",
"openforms.authentication.static_variables.apps.AuthStaticVariables",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.16 on 2022-11-24 15:49

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("custom_field_types", "0002_alter_familymemberstypeconfig_table"),
]

operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.DeleteModel(
name="FamilyMembersTypeConfig",
),
],
database_operations=[],
),
]
14 changes: 4 additions & 10 deletions src/openforms/formio/components/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
from ..registry import BasePlugin, register
from ..typing import Component
from ..utils import conform_to_mask
from .np_family_members.constants import FamilyMembersDataAPIChoices
from .np_family_members.haal_centraal import get_np_children_haal_centraal
from .np_family_members.models import FamilyMembersTypeConfig
from .np_family_members.stuf_bg import get_np_children_stuf_bg

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,16 +74,6 @@ class NPFamilyMembers(BasePlugin):

@staticmethod
def _get_handler() -> Callable[[str], list[tuple[str, str]]]:
# TODO: move these into a subpackage of openforms.formio
from openforms.custom_field_types.constants import FamilyMembersDataAPIChoices
from openforms.custom_field_types.handlers.haal_centraal import (
get_np_children_haal_centraal,
)
from openforms.custom_field_types.handlers.stuf_bg import (
get_np_children_stuf_bg,
)
from openforms.custom_field_types.models import FamilyMembersTypeConfig

handlers = {
FamilyMembersDataAPIChoices.haal_centraal: get_np_children_haal_centraal,
FamilyMembersDataAPIChoices.stuf_bg: get_np_children_stuf_bg,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Generated by Django 3.2.16 on 2022-11-24 15:49

from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
("custom_field_types", "0002_alter_familymemberstypeconfig_table"),
]

operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.CreateModel(
name="FamilyMembersTypeConfig",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"data_api",
models.CharField(
choices=[
("haal_centraal", "Haal Centraal"),
("stuf_bg", "StufBg"),
],
help_text="Which API to use to retrieve the data of the family members.",
max_length=100,
verbose_name="data api",
),
),
],
options={
"verbose_name": "Family members type configuration",
"db_table": "custom_field_types_familymemberstypeconfig",
},
),
],
database_operations=[],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 3.2.16 on 2022-11-24 15:56

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
("np_family_members", "0001_initial"),
]

operations = [
migrations.AlterModelTable(
name="familymemberstypeconfig",
table=None,
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ class FamilyMembersTypeConfig(SingletonModel):

class Meta:
verbose_name = _("Family members type configuration")
db_table = "custom_field_types_familymemberstypeconfig"
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from stuf.tests.factories import StufServiceFactory

from ..constants import FamilyMembersDataAPIChoices
from ..handlers.haal_centraal import get_np_children_haal_centraal
from ..handlers.stuf_bg import get_np_children_stuf_bg
from ..haal_centraal import get_np_children_haal_centraal
from ..stuf_bg import get_np_children_stuf_bg
from ..models import FamilyMembersTypeConfig


Expand Down

0 comments on commit cd46627

Please sign in to comment.