summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/models.py
diff options
context:
space:
mode:
authorClifford Gama <cliffygamy@gmail.com>2025-10-21 11:34:58 +0200
committerJacob Walls <jacobtylerwalls@gmail.com>2025-10-29 15:00:52 -0400
commitbe7f68422d4c6ae568a17f1fa91aac67d284df82 (patch)
treeff051b66bd991593959d3dd4d39e7e3d71a95ba0 /tests/postgres_tests/models.py
parentadc25a9a6696f7e2ab6181aabce3a23e027d6703 (diff)
Refs #35381 -- Delegated ArrayField element prepping to base_field.get_db_prep_save.
Previously, ArrayField always used base_field.get_db_prep_value when saving, which could differ from how base_field prepares data for save. This change overrides ArrayField.get_db_prep_save to delegate to the base_field's get_db_prep_save, ensuring elements like None in JSONField arrays are saved correctly as SQL NULL instead of JSON null.
Diffstat (limited to 'tests/postgres_tests/models.py')
-rw-r--r--tests/postgres_tests/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/postgres_tests/models.py b/tests/postgres_tests/models.py
index f07f4492b8..6a3d25a6af 100644
--- a/tests/postgres_tests/models.py
+++ b/tests/postgres_tests/models.py
@@ -79,7 +79,7 @@ class OtherTypesArrayModel(PostgreSQLModel):
models.DecimalField(max_digits=5, decimal_places=2), default=list
)
tags = ArrayField(TagField(), blank=True, null=True)
- json = ArrayField(models.JSONField(default=dict), default=list)
+ json = ArrayField(models.JSONField(default=dict), default=list, null=True)
int_ranges = ArrayField(IntegerRangeField(), blank=True, null=True)
bigint_ranges = ArrayField(BigIntegerRangeField(), blank=True, null=True)