diff --git a/src/openforms/submissions/migrations/0079_cleanup_urls.py b/src/openforms/submissions/migrations/0079_cleanup_urls.py new file mode 100644 index 0000000000..06892645b7 --- /dev/null +++ b/src/openforms/submissions/migrations/0079_cleanup_urls.py @@ -0,0 +1,29 @@ +# Generated by Django 3.2.21 on 2023-11-16 14:57 +from django.db import migrations +from django.db.migrations.state import StateApps +from django.db.backends.base.schema import BaseDatabaseSchemaEditor + +from furl import furl + + +def cleanup_submission_urls( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: + + Submission = apps.get_model("submissions", "Submission") + + for submission in Submission.objects.all(): + f = furl(submission.form_url) + f.remove(fragment=True) + submission.form_url = f.url + + submission.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ("submissions", "0078_submission_finalised_registration_backend_key"), + ] + + operations = [migrations.RunPython(cleanup_submission_urls)]