MCPcopy
hub / github.com/django/django / from_db_value

Method from_db_value

django/db/models/fields/json.py:86–96  ·  view source on GitHub ↗
(self, value, expression, connection)

Source from the content-addressed store, hash-verified

84 return name, path, args, kwargs
85
86 def from_db_value(self, value, expression, connection):
87 if value is None:
88 return value
89 # Some backends (SQLite at least) extract non-string values in their
90 # SQL datatypes.
91 if isinstance(expression, KeyTransform) and not isinstance(value, str):
92 return value
93 try:
94 return json.loads(value, cls=self.decoder)
95 except json.JSONDecodeError:
96 return value
97
98 def get_internal_type(self):
99 return "JSONField"

Callers

nothing calls this directly

Calls 1

loadsMethod · 0.45

Tested by

no test coverage detected