diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-11-05 12:35:50 +0100 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-11-06 11:18:42 +0100 |
| commit | 5c3b9d04d2fd19c7976a17d80b2bdb5ade62dd57 (patch) | |
| tree | d3bd538ebe7769884e0ef60bed4471a42e987d85 | |
| parent | db5980ddd1e739b7348662b07c9d91478d911877 (diff) | |
Removed definition of JSONObject ArgJoiner class in as_native function.
| -rw-r--r-- | django/db/models/functions/comparison.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/django/db/models/functions/comparison.py b/django/db/models/functions/comparison.py index d06f0a25a4..c897fc262f 100644 --- a/django/db/models/functions/comparison.py +++ b/django/db/models/functions/comparison.py @@ -160,16 +160,15 @@ class JSONObject(Func): ) return super().as_sql(compiler, connection, **extra_context) - def as_native(self, compiler, connection, *, returning, **extra_context): - class ArgJoiner: - def join(self, args): - pairs = zip(args[::2], args[1::2], strict=True) - return ", ".join([" VALUE ".join(pair) for pair in pairs]) + def join(self, args): + pairs = zip(args[::2], args[1::2], strict=True) + return ", ".join([" VALUE ".join(pair) for pair in pairs]) + def as_native(self, compiler, connection, *, returning, **extra_context): return self.as_sql( compiler, connection, - arg_joiner=ArgJoiner(), + arg_joiner=self, template=f"%(function)s(%(expressions)s RETURNING {returning})", **extra_context, ) |
