Skip to content

Commit

Permalink
Merge pull request #63 from jayvynl/fix-update-compile
Browse files Browse the repository at this point in the history
Fix update compiler
  • Loading branch information
jayvynl committed Nov 30, 2023
2 parents 4f30ac6 + b720a81 commit fa9e052
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions clickhouse_backend/models/fields/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,4 @@ def get_db_prep_value(self, value, connection, prepared=False):
return value

def get_db_prep_save(self, value, connection):
value = super().get_db_prep_save(value, connection)
if isinstance(value, JSON):
value = value.value
return value
5 changes: 3 additions & 2 deletions clickhouse_backend/models/sql/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def as_sql(self):
)
elif hasattr(val, "prepare_database_save"):
if field.remote_field:
val = field.get_db_prep_save(
val = field.get_db_prep_value(
val.prepare_database_save(field),
connection=self.connection,
)
Expand All @@ -212,7 +212,8 @@ def as_sql(self):
% (field, val, field.__class__.__name__)
)
else:
val = field.get_db_prep_save(val, connection=self.connection)
# update params are formatted into query string.
val = field.get_db_prep_value(val, connection=self.connection)

# Getting the placeholder for the field.
if hasattr(field, "get_placeholder"):
Expand Down

0 comments on commit fa9e052

Please sign in to comment.