From 5c3b9d04d2fd19c7976a17d80b2bdb5ade62dd57 Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Tue, 5 Nov 2024 12:35:50 +0100 Subject: [PATCH] Removed definition of JSONObject ArgJoiner class in as_native function. --- django/db/models/functions/comparison.py | 11 +++++------ 1 file 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, )