From 5f4e01f696ae8556be314dcbb131c5a973d29f33 Mon Sep 17 00:00:00 2001 From: bogdanbatog Date: Wed, 26 Jun 2019 12:34:36 +0300 Subject: [PATCH] don't crash on JsonFields --- scooby/plugins/sql/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scooby/plugins/sql/plugin.py b/scooby/plugins/sql/plugin.py index b67e89f..d4626e1 100644 --- a/scooby/plugins/sql/plugin.py +++ b/scooby/plugins/sql/plugin.py @@ -1,6 +1,7 @@ import threading from datetime import datetime, date +from django.contrib.postgres.fields.jsonb import JsonAdapter from django.db.models.sql.compiler import SQLCompiler from scooby.plugins_base import Plugin @@ -23,6 +24,8 @@ def get_escaped_params(params): escaped_params.append(int(param)) elif isinstance(param, (datetime, date)): escaped_params.append(param.isoformat()) + elif isinstance(param, JsonAdapter): + escaped_params.append(param.adapted) else: escaped_params.append(param) return tuple(escaped_params)