Skip to content

Commit f713cdb

Browse files
🗃️ [#4486] Squashed objects API registration migrations to 2.6
Release 2.7 makes further changes, so those migrations can be squashed as part of the 2.8 release cycle.
1 parent fc4a1df commit f713cdb

5 files changed

+283
-319
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# Generated by Django 4.2.11 on 2024-07-04 14:28
2+
3+
import django.db.models.deletion
4+
from django.db import migrations, models
5+
6+
import openforms.registrations.contrib.objects_api.models
7+
import openforms.template.validators
8+
import openforms.utils.validators
9+
10+
11+
class Migration(migrations.Migration):
12+
13+
replaces = [
14+
("registrations_objects_api", "0001_initial"),
15+
("registrations_objects_api", "0002_auto_20210802_1131"),
16+
("registrations_objects_api", "0003_auto_20210831_1310"),
17+
("registrations_objects_api", "0004_auto_20210902_2120"),
18+
("registrations_objects_api", "0005_auto_20211015_1334"),
19+
("registrations_objects_api", "0006_objectsapiconfig_catalogi_service"),
20+
("registrations_objects_api", "0007_objectsapiconfig_content_json"),
21+
("registrations_objects_api", "0008_replace_content_json_hardcoded_variable"),
22+
(
23+
"registrations_objects_api",
24+
"0009_objectsapiconfig_payment_status_update_json",
25+
),
26+
("registrations_objects_api", "0010_objectsapiconfig_objecttypes_service"),
27+
("registrations_objects_api", "0011_create_objecttypesypes_service_from_url"),
28+
("registrations_objects_api", "0012_fill_required_fields"),
29+
("registrations_objects_api", "0013_objectsapiregistrationdata"),
30+
(
31+
"registrations_objects_api",
32+
"0014_remove_objectsapiregistrationdata_attachment_urls_and_more",
33+
),
34+
(
35+
"registrations_objects_api",
36+
"0015_alter_objectsapiconfig_objecttype_and_more",
37+
),
38+
]
39+
40+
initial = True
41+
42+
dependencies = [
43+
("zgw_consumers", "0012_auto_20210104_1039"),
44+
("forms", "0001_initial_to_v250"),
45+
("submissions", "0004_auto_20231128_1536"),
46+
("zgw_consumers", "0019_alter_service_uuid"),
47+
]
48+
49+
operations = [
50+
migrations.CreateModel(
51+
name="ObjectsAPIRegistrationData",
52+
fields=[
53+
(
54+
"id",
55+
models.AutoField(
56+
auto_created=True,
57+
primary_key=True,
58+
serialize=False,
59+
verbose_name="ID",
60+
),
61+
),
62+
(
63+
"pdf_url",
64+
models.URLField(
65+
blank=True,
66+
help_text="The PDF URL of the document on the Documents API.",
67+
verbose_name="pdf url",
68+
),
69+
),
70+
(
71+
"csv_url",
72+
models.URLField(
73+
blank=True,
74+
help_text="The CSV URL of the document on the Documents API.",
75+
verbose_name="csv url",
76+
),
77+
),
78+
(
79+
"submission",
80+
models.OneToOneField(
81+
help_text="The submission linked to the registration data.",
82+
on_delete=django.db.models.deletion.CASCADE,
83+
related_name="objects_api_registration_data",
84+
to="submissions.submission",
85+
verbose_name="submission",
86+
),
87+
),
88+
],
89+
),
90+
migrations.CreateModel(
91+
name="ObjectsAPISubmissionAttachment",
92+
fields=[
93+
(
94+
"id",
95+
models.AutoField(
96+
auto_created=True,
97+
primary_key=True,
98+
serialize=False,
99+
verbose_name="ID",
100+
),
101+
),
102+
(
103+
"document_url",
104+
models.URLField(
105+
help_text="The URL of the submission attachment registered in the Documents API.",
106+
verbose_name="document_url",
107+
),
108+
),
109+
(
110+
"submission_file_attachment",
111+
models.ForeignKey(
112+
help_text="The submission file attachment.",
113+
on_delete=django.db.models.deletion.CASCADE,
114+
to="submissions.submissionfileattachment",
115+
verbose_name="submission file attachment",
116+
),
117+
),
118+
],
119+
),
120+
migrations.CreateModel(
121+
name="ObjectsAPIConfig",
122+
fields=[
123+
(
124+
"id",
125+
models.AutoField(
126+
auto_created=True,
127+
primary_key=True,
128+
serialize=False,
129+
verbose_name="ID",
130+
),
131+
),
132+
(
133+
"objecttype",
134+
models.URLField(
135+
blank=True,
136+
editable=False,
137+
help_text="Default URL of the ProductAanvraag OBJECTTYPE in the Objecttypes API. The objecttype should have the following three attributes: 1) submission_id; 2) type (the type of productaanvraag); 3) data (the submitted form data)",
138+
max_length=1000,
139+
verbose_name="objecttype",
140+
),
141+
),
142+
(
143+
"objecttype_version",
144+
models.IntegerField(
145+
blank=True,
146+
editable=False,
147+
help_text="Default version of the OBJECTTYPE in the Objecttypes API",
148+
null=True,
149+
verbose_name="objecttype version",
150+
),
151+
),
152+
(
153+
"productaanvraag_type",
154+
models.CharField(
155+
blank=True,
156+
help_text="Description of the 'ProductAanvraag' type. This value is saved in the 'type' attribute of the 'ProductAanvraag'.",
157+
max_length=255,
158+
verbose_name="Productaanvraag type",
159+
),
160+
),
161+
(
162+
"objects_service",
163+
models.OneToOneField(
164+
limit_choices_to={"api_type": "orc"},
165+
null=True,
166+
on_delete=django.db.models.deletion.PROTECT,
167+
related_name="+",
168+
to="zgw_consumers.service",
169+
verbose_name="Objects API",
170+
),
171+
),
172+
(
173+
"drc_service",
174+
models.OneToOneField(
175+
limit_choices_to={"api_type": "drc"},
176+
null=True,
177+
on_delete=django.db.models.deletion.PROTECT,
178+
related_name="+",
179+
to="zgw_consumers.service",
180+
verbose_name="Documenten API",
181+
),
182+
),
183+
(
184+
"informatieobjecttype_attachment",
185+
models.URLField(
186+
blank=True,
187+
help_text="Default URL that points to the INFORMATIEOBJECTTYPE in the Catalogi API to be used for the submission attachments",
188+
max_length=1000,
189+
verbose_name="attachment informatieobjecttype",
190+
),
191+
),
192+
(
193+
"informatieobjecttype_submission_report",
194+
models.URLField(
195+
blank=True,
196+
help_text="Default URL that points to the INFORMATIEOBJECTTYPE in the Catalogi API to be used for the submission report PDF",
197+
max_length=1000,
198+
verbose_name="submission report informatieobjecttype",
199+
),
200+
),
201+
(
202+
"organisatie_rsin",
203+
models.CharField(
204+
blank=True,
205+
help_text="Default RSIN of organization, which creates the INFORMATIEOBJECT",
206+
max_length=9,
207+
validators=[openforms.utils.validators.RSINValidator()],
208+
verbose_name="organisation RSIN",
209+
),
210+
),
211+
(
212+
"informatieobjecttype_submission_csv",
213+
models.URLField(
214+
blank=True,
215+
help_text="Default URL that points to the INFORMATIEOBJECTTYPE in the Catalogi API to be used for the submission report CSV",
216+
max_length=1000,
217+
verbose_name="submission report CSV informatieobjecttype",
218+
),
219+
),
220+
(
221+
"catalogi_service",
222+
models.OneToOneField(
223+
limit_choices_to={"api_type": "ztc"},
224+
null=True,
225+
on_delete=django.db.models.deletion.PROTECT,
226+
related_name="+",
227+
to="zgw_consumers.service",
228+
verbose_name="Catalogi API",
229+
),
230+
),
231+
(
232+
"content_json",
233+
models.TextField(
234+
default=openforms.registrations.contrib.objects_api.models.get_content_text,
235+
help_text="This template is evaluated with the submission data and the resulting JSON is sent to the objects API.",
236+
validators=[
237+
openforms.template.validators.DjangoTemplateValidator(
238+
backend="openforms.template.openforms_backend"
239+
)
240+
],
241+
verbose_name="JSON content template",
242+
),
243+
),
244+
(
245+
"payment_status_update_json",
246+
models.TextField(
247+
default=openforms.registrations.contrib.objects_api.models.get_payment_status_update_text,
248+
help_text="This template is evaluated with the submission data and the resulting JSON is sent to the objects API with a PATCH to update the payment field.",
249+
validators=[
250+
openforms.template.validators.DjangoTemplateValidator(
251+
backend="openforms.template.openforms_backend"
252+
)
253+
],
254+
verbose_name="payment status update JSON template",
255+
),
256+
),
257+
(
258+
"objecttypes_service",
259+
models.OneToOneField(
260+
limit_choices_to={"api_type": "orc"},
261+
null=True,
262+
on_delete=django.db.models.deletion.PROTECT,
263+
related_name="+",
264+
to="zgw_consumers.service",
265+
verbose_name="Objecttypes API",
266+
),
267+
),
268+
],
269+
options={
270+
"verbose_name": "Objects API configuration",
271+
},
272+
),
273+
]
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
11
# Generated by Django 3.2.19 on 2023-06-29 07:10
22
from django.db import migrations
3-
from django.db.models import Value
4-
from django.db.models.functions import Replace
5-
6-
7-
def replace_terugbelnotitie_with_variable(apps, schema_editor):
8-
apps.get_model("registrations_objects_api", "objectsapiconfig").objects.update(
9-
content_json=Replace(
10-
"content_json",
11-
Value("terugbelnotitie"),
12-
Value("{{ productaanvraag_type }}"),
13-
)
14-
)
153

164

175
class Migration(migrations.Migration):
186
dependencies = [
197
("registrations_objects_api", "0007_objectsapiconfig_content_json"),
208
]
219

22-
operations = [
23-
migrations.RunPython(
24-
replace_terugbelnotitie_with_variable,
25-
migrations.RunPython.noop,
26-
)
27-
]
10+
# RunPython operation removed as part of 2.7 release cycle, which requires 2.6.7 to
11+
# be run first.
12+
operations = []

0 commit comments

Comments
 (0)