Skip to content

Commit

Permalink
[#3362] Add a migration to clean up urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Nov 16, 2023
1 parent a6d6282 commit 0d236a6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/openforms/submissions/migrations/0079_cleanup_urls.py
Original file line number Diff line number Diff line change
@@ -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)]

0 comments on commit 0d236a6

Please sign in to comment.