Skip to content

Commit

Permalink
fix json filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro committed Jan 6, 2018
1 parent 20fd5dd commit 8324afc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wagtail_calendar/templatetags/wagtail_calendar_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
'>': '\\u003E',
'<': '\\u003C',
'&': '\\u0026',
'"': '&quot;',
}


@register.filter(name='json', is_safe=True)
def json_filter(value):
text = json.dumps(value, cls=DjangoJSONEncoder)
for char, to in JSON_TAG_ESCAPES.items():
text.replace(char, to)
return mark_safe(text)
text = text.replace(char, to)
return mark_safe(text.replace('"', '&quot;'))

0 comments on commit 8324afc

Please sign in to comment.