Skip to content
Browse files

Replace conditionals with as_mysql in StringKeyTransformTextLookupMixin

  • Loading branch information
laymonage committed Jun 4, 2019
1 parent 632494d commit 7651f8d7a613e448837818b149c296d8540f12be
Showing with 7 additions and 8 deletions.
  1. +7 −8 jsonfallback/
@@ -314,14 +314,13 @@ def __init__(self, key_transform, *args, **kwargs):

class StringKeyTransformTextLookupMixin(KeyTransformTextLookupMixin):
def process_rhs(self, compiler, connection):
rhs = super().process_rhs(compiler, connection)
if connection.vendor == 'mysql':
params = []
for p in rhs[1]:
return rhs[0], params
return rhs
def as_mysql(self, compiler, connection):
lhs, lhs_params = super().process_lhs(compiler, connection)
rhs, rhs_params = super().process_rhs(compiler, connection)
rhs_params = [json.dumps(p) for p in rhs_params]
params = lhs_params + rhs_params
rhs = self.get_rhs_op(connection, rhs)
return '%s %s' % (lhs, rhs), params

class NonStringKeyTransformTextLookupMixin:

0 comments on commit 7651f8d

Please sign in to comment.
You can’t perform that action at this time.