How to change to string and remove ' from Django tempalates / context? How to change to string and remove ' from Django tempalates / context? json json

How to change to string and remove ' from Django tempalates / context?


You can try to prevent string escape in template like this:

{{ variable|safe }}

In-view way:

from django.utils.safestring import mark_safefrom django.template import Contextdata=mark_safe(data) inescapable = Context({'data': data}, autoescape=False)


I know this is old but other people might stumble upon this with the same problem

Try

{% autoscape off %} {{ date }} {% endautoscape %}

It worked fine for me


When requesting graphs from google charts the data must be sent as a text array. The csv file has to be pure text with no apostrophes.howevercode fragmentdata = repr(textData)returns data bounded by ' 'this is interpreted as "&#39" in html

The solution to this is to javascript split methodvar par = textData.split(""&#39") textArray = par[1] // the part without 'rest of code