@register.filter(name='angular_escapes')
def angular_escapes(value):
 return value.replace('\\', '\\\\').replace('"', '\\"').replace("'", "\\'").replace('\n', '\\n').replace('\r', '\\r')

@ register . filter ( name = 'angular_escapes' ) def angular_escapes ( value ) : return value . replace ( '\\' , '\\\\' ) . replace ( '"' , '\\"' ) . replace ( "'" , "\\'" ) . replace ( '\n' , '\\n' ) . replace ( '\r' , '\\r' )
djangos escapejs is too aggressive and inserts unicode .