From f987897ef7ef2f8dd7f585fc411a2fd24c3f4545 Mon Sep 17 00:00:00 2001 From: Rupika Date: Fri, 15 Feb 2019 22:41:54 -0800 Subject: [PATCH] prints out JSON with section & field details --- back/backend/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/back/backend/views.py b/back/backend/views.py index 8331b9f..4f5c067 100644 --- a/back/backend/views.py +++ b/back/backend/views.py @@ -250,15 +250,18 @@ def section(request, report_pk, section_pk): s = Section.objects.get(id=section_pk) if complete: s.completed = True - s.save() else: s.completed = False + s.save() + # get section and field details data = { - "message": "Updated report {0}, section {1}.".format(report_pk, section_pk), - "section completion": s.completed, - "request_data": "{}".format(request.data) + "id": s.id, + "completed": s.completed, + "title": s.title, + "html_description": s.html_description, } + data.update(get_fields(s.id)) return JsonResponse(data) # function checks if a field is complete