@register.filter
def to_js(value):
 return mark_safe(('JSON.parse("%s")' % escapejs(jsonify(value))))

@ register . filter def to_js ( value ) : return mark_safe ( ( 'JSON.parse("%s")' % escapejs ( jsonify ( value ) ) ) )
returns a string which leaves the value readily available for js consumption .