Merge pull request #85: Return section json when section updated
prints out JSON with section & field details
This commit is contained in:
commit
c5b50715d3
1 changed files with 7 additions and 4 deletions
|
@ -250,15 +250,18 @@ def section(request, report_pk, section_pk):
|
||||||
s = Section.objects.get(id=section_pk)
|
s = Section.objects.get(id=section_pk)
|
||||||
if complete:
|
if complete:
|
||||||
s.completed = True
|
s.completed = True
|
||||||
s.save()
|
|
||||||
else:
|
else:
|
||||||
s.completed = False
|
s.completed = False
|
||||||
|
s.save()
|
||||||
|
|
||||||
|
# get section and field details
|
||||||
data = {
|
data = {
|
||||||
"message": "Updated report {0}, section {1}.".format(report_pk, section_pk),
|
"id": s.id,
|
||||||
"section completion": s.completed,
|
"completed": s.completed,
|
||||||
"request_data": "{}".format(request.data)
|
"title": s.title,
|
||||||
|
"html_description": s.html_description,
|
||||||
}
|
}
|
||||||
|
data.update(get_fields(s.id))
|
||||||
return JsonResponse(data)
|
return JsonResponse(data)
|
||||||
|
|
||||||
# function checks if a field is complete
|
# function checks if a field is complete
|
||||||
|
|
Loading…
Reference in a new issue