def to_python(self, value): """Convert our string value to JSON after we load it from the DB""" if value in ("", None): return None try: if isinstance(value, basestring): return json.loads(value, object_hook=decode_object) except ValueError: pass return value
def to_python(self, value): """Convert our string value to JSON after we load it from the DB""" if value == "": return None try: if isinstance(value, basestring): return json.loads(value, object_hook=decode_object) except ValueError: pass return value
def to_python(self, value): """Convert our string value to JSON after we load it from the DB""" if value in ("", None): return None try: if isinstance(value, (str, unicode)): return json.loads( value, object_hook=decode_object if self.pickle else None) except ValueError: pass return value
def value_from_datadict(self, data, files, name): value = data.get(name, '').strip() if value in ['', None]: return {} return json.loads(value)