1

I like bootstrap and I am trying to add a bootstrap sortable & searchable table(s) to my django site. like on http://wenzhixin.net.cn/

the example code looks fairly strait forward. except that i cannot figure out the very first part data-url="data1.json"

<table data-url="data1.json" data-height="299" data-sort-name="name" data-sort-order="desc">
    <thead>
        <tr>
            <th data-field="id" data-align="right" data-sortable="true">Item ID</th>
            <th data-field="name" data-align="center" data-sortable="true">Item Name</th>
            <th data-field="price" data-sortable="true">Item Price</th>
        </tr>
    </thead>
</table>

I am able to create Json data bassed on this Stackoverflow Creating a JSON response using Django and Python but I cannot figure out how to format it as a url that django/table can access.

Community
  • 1
  • 1
Jay42
  • 417
  • 1
  • 11
  • 24
  • You can create new view returned a HttpResponse containing your json results. To create json, you can dump your data as a dictionary and dump it with json built in module in python. or django built in serializer from your model queryset. – Adiyat Mubarak Nov 25 '14 at 23:41

0 Answers0