-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [#4908] Add config checks for JSON registration plugin
Will check the connection to the configured service
- Loading branch information
1 parent
295f464
commit c4a5834
Showing
6 changed files
with
113 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.contrib import admin | ||
|
||
from solo.admin import SingletonModelAdmin | ||
|
||
from .models import JSONConfig | ||
|
||
|
||
@admin.register(JSONConfig) | ||
class JSONConfigAdmin(SingletonModelAdmin): | ||
pass |
44 changes: 44 additions & 0 deletions
44
src/openforms/registrations/contrib/json/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Generated by Django 4.2.17 on 2024-12-30 12:49 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
("zgw_consumers", "0022_set_default_service_slug"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="JSONConfig", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"service", | ||
models.OneToOneField( | ||
help_text="Service for JSON registration plugin", | ||
limit_choices_to={"api_type": "orc"}, | ||
null=True, | ||
on_delete=django.db.models.deletion.PROTECT, | ||
to="zgw_consumers.service", | ||
verbose_name="Service", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "JSON registration configuration", | ||
}, | ||
), | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from solo.models import SingletonModel | ||
from zgw_consumers.constants import APITypes | ||
|
||
|
||
class JSONConfigManager(models.Manager): | ||
def get_queryset(self): | ||
return super().get_queryset().select_related("service") | ||
|
||
|
||
class JSONConfig(SingletonModel): | ||
""" | ||
Global configuration and defaults | ||
""" | ||
|
||
service = models.OneToOneField( | ||
"zgw_consumers.Service", | ||
verbose_name=_("Service"), | ||
on_delete=models.PROTECT, | ||
limit_choices_to={"api_type": APITypes.orc}, | ||
null=True, | ||
help_text=_("Service for JSON registration plugin"), | ||
) | ||
|
||
objects = JSONConfigManager() | ||
|
||
class Meta: | ||
verbose_name = _("JSON registration configuration") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters