diff options
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r-- | ishtar_common/views.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 10c62d465..efd7a9de1 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -525,9 +525,14 @@ def get_item(model, func_name, default_name, extra_request_keys=[], my_vals = [format_val(v) for v in vals] else: new_vals = [] - for idx, v in enumerate(vals): - new_vals.append("{}{}{}".format( - my_vals[idx], settings.JOINT, format_val(v))) + if not vals: + for idx, my_v in enumerate(my_vals): + new_vals.append(u"{}{}{}".format( + my_v, u' - ', '')) + else: + for idx, v in enumerate(vals): + new_vals.append(u"{}{}{}".format( + my_vals[idx], u' - ', format_val(v))) my_vals = new_vals[:] data.append(", ".join(my_vals) or u"") datas.append(data) @@ -563,9 +568,10 @@ def get_item(model, func_name, default_name, extra_request_keys=[], for idx, value in enumerate(data[1:]): if value: table_col = table_cols[idx] - if type(table_col) in (list, tuple): - table_col = table_col[0] - res[table_col.split('.')[-1]] = value + if type(table_col) not in (list, tuple): + table_col = [table_col] + k = "__".join([tc.split('.')[-1] for tc in table_col]) + res[k] = value rows.append(res) data = json.dumps({ "records": items_nb, |