I am trying to pass some data from my django app into a javascript following the answers this question
views.py
context['username'] = json.dumps(request.user.username)
test_script.js
document.write('Script working')
username = {{ username|safe }};
But in console I get the error
Uncaught SyntaxError: Unexpected token '{'
What am I missing?