view에서 프론트 js로 텍스트 넘겼더니 깨짐
조회: 190
댓글: 0개
2023.11.16 11:06 목요일
문제
Django views에서 탬플리승로 '을 넘겼더니 '
로 출력되는 상황
context = {
'test': {'abc': '123'}
}
return render(request, 'index.html', )
const A = {{test}}
console.log(A);
//결과
{'abc': '123'}
해결
safe 탬플릿 태그를 사용한다.
const A = {{test|safe}}