Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# inspired by : https://github.com/devkral/django-simple-jsonfield # MIT license
""" JSON field implementation on top of django textfield """
""" convert json string to python dictionary """ except json.decoder.JSONDecodeError as e: raise ValidationError(message=str(e), code="json_error")
""" convert python dictionary to json string """
""" convert string from db to python dictionary """ return value
""" convert model input value to python dictionary """ if isinstance(value, (dict, list)): return value if value is None: return value return self.to_dict(value)
"""convert python dictionary to string before writing to db""" |