add connection to get_db_prep_save
This commit is contained in:
parent
798f366b8a
commit
076020bd84
1 changed files with 4 additions and 4 deletions
|
@ -49,11 +49,11 @@ class DictField(models.TextField):
|
||||||
assert isinstance(value, dict)
|
assert isinstance(value, dict)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_db_prep_save(self, value):
|
def get_db_prep_save(self, value, connection):
|
||||||
"""Convert our JSON object to a string before we save"""
|
"""Convert our JSON object to a string before we save"""
|
||||||
assert isinstance(value, dict)
|
assert isinstance(value, dict)
|
||||||
value = json.dumps(value, default=to_json)
|
value = json.dumps(value, default=to_json)
|
||||||
return super(DictField, self).get_db_prep_save(value)
|
return super(DictField, self).get_db_prep_save(value, connection)
|
||||||
|
|
||||||
class TupleField(models.TextField):
|
class TupleField(models.TextField):
|
||||||
"""TupleField is a textfield that contains JSON-serialized tuples."""
|
"""TupleField is a textfield that contains JSON-serialized tuples."""
|
||||||
|
@ -73,11 +73,11 @@ class TupleField(models.TextField):
|
||||||
assert isinstance(value, list)
|
assert isinstance(value, list)
|
||||||
return tuple(value)
|
return tuple(value)
|
||||||
|
|
||||||
def get_db_prep_save(self, value):
|
def get_db_prep_save(self, value, connection):
|
||||||
"""Convert our JSON object to a string before we save"""
|
"""Convert our JSON object to a string before we save"""
|
||||||
assert isinstance(value, tuple)
|
assert isinstance(value, tuple)
|
||||||
value = json.dumps(value, default=to_json)
|
value = json.dumps(value, default=to_json)
|
||||||
return super(TupleField, self).get_db_prep_save(value)
|
return super(TupleField, self).get_db_prep_save(value, connection)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from south.modelsinspector import add_introspection_rules
|
from south.modelsinspector import add_introspection_rules
|
||||||
|
|
Loading…
Reference in a new issue