1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00: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) return super().as_sql(compiler, connection, **extra_context)
def as_native(self, compiler, connection, *, returning, **extra_context): def join(self, args):
class ArgJoiner: pairs = zip(args[::2], args[1::2], strict=True)
def join(self, args): return ", ".join([" VALUE ".join(pair) for pair in pairs])
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( return self.as_sql(
compiler, compiler,
connection, connection,
arg_joiner=ArgJoiner(), arg_joiner=self,
template=f"%(function)s(%(expressions)s RETURNING {returning})", template=f"%(function)s(%(expressions)s RETURNING {returning})",
**extra_context, **extra_context,
) )