/ / डोजो में टेम्पलेट टैग के लिए मैं Django का उपयोग कैसे करूं? - django, django-templates, dojo, dojox.grid.datagrid

Dojo में टेम्पलेट टैग के लिए मैं Django का उपयोग कैसे करूं? - django, django-templates, dojo, dojox.grid.datagrid

मैं अपने जावास्क्रिप्ट में "के लिए" Django टेम्पलेट टैग का उपयोग करने की कोशिश कर रहा हूं। मैं आइटम की सूची बनाने के लिए दोजो के डेटाग्रिड का उपयोग कर रहा हूं। यह मेरा कोड है:

<script type="text/javascript">
require(["dojox/grid/DataGrid" , "dojo/data/ItemFileWriteStore" , "dojo/dom" , "dojo/domReady!"],
function(DataGrid, ItemFileWriteStore, dom){
/*set up data store*/
var data = {
identifier: "id",
items: []
};

{% for item in items_list %}
data.items.push({ id: {{ item.url }} + "_" + {{ item.id }}, col1: {{ item.description }} });
{% endfor %}

var store = new ItemFileWriteStore({data: data});

/*set up layout*/
var layout = [[
{"name": "Description", "field": "id", "width": "100px"}
]];

/*create a new grid*/
var grid = new DataGrid({
id: "grid",
store: store,
structure: layout,
rowSelector: "20px"
}, "grid");

/*Call startup() to render the grid*/
grid.startup();
});
</script>

हालांकि, जब मैं अपने वेबपेज पर जाता हूं, तो मुझे यह त्रुटि मिलती है:

Uncaught SyntaxError: Unexpected identifier

मैं गलत क्या कर रहा हूं और मैं इसे कैसे ठीक करूं? धन्यवाद!

उत्तर:

जवाब के लिए 0 № 1

आपको शब्दकोश में मूल्यों के चारों ओर उद्धरण जोड़ने की आवश्यकता है

data.items.push({ id: "{{ item.url }}_{{ item.id }}", col1: "{{ item.description }}" });