summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Gama <cliffygamy@gmail.com>2025-11-09 11:32:25 +0200
committerJacob Walls <jacobtylerwalls@gmail.com>2025-11-12 17:14:52 -0500
commit66b5a6de78ac3bcdf586844eac61663fece10ab5 (patch)
tree08219bda580ea1b5370344c935cb9a78808900ef
parenta1ce852e52f45da7528446cef3a1f02416531771 (diff)
Refs #35381 -- Made JSONNull deconstruct using convenient import path.
-rw-r--r--django/db/models/fields/json.py2
-rw-r--r--tests/model_fields/test_jsonfield.py7
2 files changed, 9 insertions, 0 deletions
diff --git a/django/db/models/fields/json.py b/django/db/models/fields/json.py
index 819c87119a..8ca9cc6811 100644
--- a/django/db/models/fields/json.py
+++ b/django/db/models/fields/json.py
@@ -12,6 +12,7 @@ from django.db.models.lookups import (
PostgresOperatorLookup,
Transform,
)
+from django.utils.deconstruct import deconstructible
from django.utils.deprecation import RemovedInDjango70Warning, django_file_prefixes
from django.utils.translation import gettext_lazy as _
@@ -150,6 +151,7 @@ class JSONField(CheckFieldDefaultMixin, Field):
)
+@deconstructible(path="django.db.models.JSONNull")
class JSONNull(expressions.Value):
"""Represent JSON `null` primitive."""
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py
index 937b557794..cf8e1888e5 100644
--- a/tests/model_fields/test_jsonfield.py
+++ b/tests/model_fields/test_jsonfield.py
@@ -1265,6 +1265,13 @@ class JSONNullTests(TestCase):
def test_repr(self):
self.assertEqual(repr(JSONNull()), "JSONNull()")
+ def test_deconstruct(self):
+ jsonnull = JSONNull()
+ path, args, kwargs = jsonnull.deconstruct()
+ self.assertEqual(path, "django.db.models.JSONNull")
+ self.assertEqual(args, ())
+ self.assertEqual(kwargs, {})
+
def test_save_load(self):
obj = JSONModel(value=JSONNull())
obj.save()