From f8b6d665c7a0f609da7a074713529d8bc49dd263 Mon Sep 17 00:00:00 2001 From: Rupika Date: Thu, 7 Feb 2019 18:21:57 -0800 Subject: [PATCH] changed the data_values to display as just "value" in the JSON data dict --- back/backend/views.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/back/backend/views.py b/back/backend/views.py index 3ef2682..ff7facf 100644 --- a/back/backend/views.py +++ b/back/backend/views.py @@ -52,13 +52,13 @@ def get_fields(s_id): for i in queryset: # function to print corresponding datatype - key, value = get_datatype(i) + value = get_datatype(i) data = { "field_name": i.field_name, "label": i.label, "type": i.type, "number": i.number, - key: value + "value": value } # append the fields to array # use copy() to avoid overwriting @@ -75,19 +75,19 @@ def to_json(convert): def get_datatype(self): if self.type == "boolean": if self.data_bool: - return "data_bool", True + return True else: - return "data_bool", False + return False elif self.type == "decimal": - return "decimal", self.data_decimal + return self.data_decimal elif self.type == "date": - return "date", "{}".format(self.data_date) + return "{}".format(self.data_date) elif self.type == "file": - return "file", "{}".format(self.data_file) + return "{}".format(self.data_file) elif self.type == "string": - return "string", "{}".format(self.data_string) + return "{}".format(self.data_string) elif self.type == "integer": - return "integer", self.data_integer + return self.data_integer # API Endpoints