Reputation: 1270
In my Django template I have the following code:
series: [{
name: 'Ratings',
data: [
{% for item in graph_data %}
{
name: "{{item}}",
x: Date.UTC({{item.date.year}},{{item.date.month}},{{item.date.day}}),
y: {{item.rating}}
},
{% endfor %}
]
}]
However, when the name has a single quote in it, such as:
The Story Behind 'Toy Story'
On the graph it gets displayed as:
The Story Behind %#39;Toy Story'
Upvotes: 1
Views: 754
Reputation: 19573
See here
https://docs.djangoproject.com/en/1.1/topics/templates/
and it says
By default in Django, every template automatically escapes the output of every variable tag. Specifically, these five characters are escaped:
< is converted to <
> is converted to >
' (single quote) is converted to '
" (double quote) is converted to "
& is converted to &
For individual variables
To disable auto-escaping for an individual variable, use the safe filter:
This will be escaped: {{ data }}
This will not be escaped: {{ data|safe }}
Upvotes: 1