Skip to content

Commit d8e44ab

Browse files
committed
fix json response structure to be same as original apijson api (java); because api changed, version restart with 0.2.0
1 parent 609dff7 commit d8e44ab

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

uliweb_apijson/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = '0.1.4'
1+
__version__ = '0.2.0'
22
__url__ = 'https://github.com/zhangchunlin/uliweb-apijson'
33
__author__ = 'Chunlin Zhang'
44
__email__ = 'zhangchunlin@gmail.com'

uliweb_apijson/apijson/templates/vue/inc_apijson_table.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
"@page":thisp.current_page-1,
176176
"@query":2
177177
}
178-
arr_params[this.model_name] = {
178+
arr_params[thisp.model_name] = {
179179
"@order":thisp.sort_key+thisp.sort_order,
180180
"@role":"{{=role}}"
181181
}
@@ -194,6 +194,10 @@
194194
thisp.loading = false
195195
if (data.code==200) {
196196
var arr = data["[]"]
197+
for (var i=0;i<arr.length;i++) {
198+
arr[i] = arr[i][thisp.model_name]
199+
}
200+
197201
if (!thisp.tcolumns_init) {
198202
if (thisp.config_table_fields!=null){
199203
thisp.tcolumns = thisp.config_table_fields
@@ -210,6 +214,7 @@
210214
var col = {title:k,key:k}
211215
if (typeof item[k] ==="boolean") {
212216
col["width"] = 80
217+
col["component"] = "checkbox"
213218
}
214219
else if (typeof item[k] ==="number") {
215220
col["width"] = 100

uliweb_apijson/apijson/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def _get_array(self,key):
237237
q = q.order_by(getattr(column,sort_order)())
238238

239239
def _get_info(i):
240+
resultd = {}
240241
d = i.to_dict()
241242
if secret_fields:
242243
for k in secret_fields:
@@ -246,7 +247,8 @@ def _get_info(i):
246247
for k in keys:
247248
if k not in model_column_set:
248249
del d[k]
249-
return d
250+
resultd[model_name] = d
251+
return resultd
250252
l = [_get_info(i) for i in q]
251253
self.rdict[key] = l
252254

0 commit comments

Comments
 (0)