Skip to content

Commit 9c4bfa7

Browse files
committed
v0.20.1: Fix Decimal serialization in form_data JSONField
- Add DjangoJSONEncoder to FormSubmission.form_data so Decimal values (e.g. currency fields) serialize correctly on save - Fixes 500 error on approve_submission when form_data contains Decimals
1 parent 2020360 commit 9c4bfa7

3 files changed

Lines changed: 28 additions & 2 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Generated by Django 5.2.7 on 2026-03-12 20:30
2+
3+
import django.core.serializers.json
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
("django_forms_workflows", "0042_add_sub_workflow_section_label"),
11+
]
12+
13+
operations = [
14+
migrations.AlterField(
15+
model_name="formsubmission",
16+
name="form_data",
17+
field=models.JSONField(
18+
encoder=django.core.serializers.json.DjangoJSONEncoder,
19+
help_text="The actual form responses",
20+
),
21+
),
22+
]

django_forms_workflows/models.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from django.conf import settings
88
from django.contrib.auth.models import Group
9+
from django.core.serializers.json import DjangoJSONEncoder
910
from django.db import models
1011

1112

@@ -1149,7 +1150,10 @@ class FormSubmission(models.Model):
11491150
)
11501151

11511152
# Submission Data
1152-
form_data = models.JSONField(help_text="The actual form responses")
1153+
form_data = models.JSONField(
1154+
help_text="The actual form responses",
1155+
encoder=DjangoJSONEncoder,
1156+
)
11531157
attachments = models.JSONField(
11541158
default=list, blank=True, help_text="List of uploaded file paths"
11551159
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-forms-workflows"
3-
version = "0.20.0"
3+
version = "0.20.1"
44
description = "Enterprise-grade, database-driven form builder with approval workflows and external data integration"
55
license = "LGPL-3.0-only"
66
readme = "README.md"

0 commit comments

Comments
 (0)