0
0
mirror of https://github.com/django/django.git synced 2024-11-21 10:59:04 +01:00

Removed definition of JSONObject ArgJoiner class in as_native function.

This commit is contained in:
Sarah Boyce 2024-11-05 12:35:50 +01:00
parent db5980ddd1
commit 5c3b9d04d2

View File

@ -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,
)