1👍
According to exception and django docs, your get_db_prep_save
method should take one more argument, called connection
, so this:
def get_db_prep_save(self, value, connection):
"""Convert our JSON object to a string before we save"""
if value == "":
return None
if isinstance(value, dict):
value = json.dumps(value, cls=DjangoJSONEncoder)
return super(JSONField, self).get_db_prep_save(value, connection)
should be okay.
Source:stackexchange.com