From 9d223041e5f2fac397b481cd00e755c35cdc8fe7 Mon Sep 17 00:00:00 2001 From: Ruslan Krivoshein Date: Wed, 6 Nov 2019 09:57:53 +0300 Subject: [PATCH] Fix for array param --- rest_framework_datatables_editor/viewsets.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rest_framework_datatables_editor/viewsets.py b/rest_framework_datatables_editor/viewsets.py index b1cc5db..dcf8d06 100644 --- a/rest_framework_datatables_editor/viewsets.py +++ b/rest_framework_datatables_editor/viewsets.py @@ -39,9 +39,16 @@ def read_date(data_in, data_out, rest_of_line): read_date(data_in[1:], new_data_point, rest_of_line) data = {} - for (line, value) in post.items(): + for (line, value) in post.lists(): if line.startswith('data'): line_data = re.findall(r"\[([^\[\]]*)\]", line) + + if not line_data[-1]: + del line_data[-1] + + if len(value) == 1: + value = value[0] + read_date(line_data, data, value) return data