I am having a method in views.py as follows:
def index(self, request):
initial = get_initial()
context = {\"context\" : initial_topics}
template = lo
If you want to insert into Javascript then make sure to use escapejs, and in more advanced cases you may need to use JSON.parse;
var context = "{{ context }}"
If you are still having issues, then try;
var context = JSON.parse("{{ context|escapejs }}");
The JSON.parse() method parses a JSON string, constructing the JavaScript value or object described by the string. An optional reviver function can be provided to perform a transformation on the resulting object before it is returned. doc