📅  最后修改于: 2022-03-11 15:04:28.446000             🧑  作者: Mango
//https://stackoverflow.com/questions/739942/how-to-pass-an-array-in-django-to-a-template-and-use-it-with-javascript
//In Django:
from django.utils import simplejson
json_list = simplejson.dumps(YOUR_LIST)
//AND PASS "json_list" IN CONTEXT
//In JS:
var YOUR_JS_LIST = {{YOUR_LIST|safe}};