def object_to_json ( obj , indent = 2 ) : instance_json = json . dumps ( obj , indent = indent , ensure_ascii = False , cls = DjangoJSONEncoder ) return instance_json
django template python object to javascript
transform object to json
def object_to_json(obj, indent=2):
    """
        transform object to json
    """
    instance_json = json.dumps(obj, indent=indent, ensure_ascii=False, cls=DjangoJSONEncoder)
    return instance_json