from unfold.loginrequired import LoginRequiredView
from django.http import HttpResponse
-from manifold.core.query import Query, AnalyzedQuery
+from manifold.core.query import Query
from manifoldapi.manifoldapi import execute_query
-from string import join
+from string import join
+
import decimal
import datetime
import json
req_items = request.POST
elif request.method == 'GET':
req_items = request.GET
-
- print req_items
-
+
for el in req_items.items():
if el[0].startswith('filters'):
o.filters[el[0][8:-1]] = el[1]
if request.path.split('/')[1] == 'rest' :
response_data = response
- print response
return HttpResponse(json.dumps(response_data, cls=DecimalEncoder, default=DateEncoder), content_type="application/json")
elif request.path.split('/')[1] == 'table' :
- print o.properties
- print o.options
- print response
return render_to_response('table-default.html', {'data' : response, 'properties' : o.properties, 'id' : o.id, 'options' : o.options})
elif request.path.split('/')[1] == 'datatable' :
response_data = {}
d = []
for p in o.properties :
d.append(r[p])
- #print d
-
response_data['data'].append(d)
return HttpResponse(json.dumps(response_data, cls=DecimalEncoder, default=DateEncoder), content_type="application/json")
{% load rest_filters %}
<thead>
<tr>
- {% for p in properties %}
- <th>
- {{ p }}
- </th>
- {% endfor %}
+ {% if "checkbox" in options %}<th>checkbox</th>{% endif %}
+ {% for p in properties %}<th>{{ p }}</th>{% endfor %}
</tr>
</thead>
<tbody>
{% for d in data %}
-<tr>
- {% for p in properties %}
- <td>
- <div class="line1">{{ d|key:p }}</div>
- </td>
- {% endfor %}
+<tr id="{{ id }}">
+ {% if "checkbox" in options %}<td><input type="checkbox" name="{{ id }}" /></td>{% endif %}
+ {% for p in properties %}<td><div class="line1">{{ d|key:p }}</div></td>{% endfor %}
</tr>
{% endfor %}
</tbody>
\ No newline at end of file