From 60cbf42997ddc29dcb3d577f2e62dbf36c2d81c9 Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 2 Sep 2021 07:26:13 +0530 Subject: [PATCH] Get fields correctly --- app/views.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/views.py b/app/views.py index a04aadb..20e021d 100644 --- a/app/views.py +++ b/app/views.py @@ -239,12 +239,12 @@ class PeopleDetailView(View): person = get_object_or_404(Person, id=people_id) return_data = { 'data': person.dict(), - 'resources': [r.dict() for r in person.resourcespeople_set.all()], - 'ranges': [r.dict() for r in person.rangespeople_set.all()], - 'fields': [r.name for r in person.fieldspeople_set.all()], - 'methods': [r.name for r in person.methodspeople_set.all()], - 'scales': [r.name for r in person.scalespeople_set.all()], - 'taxa': [r.name for r in person.taxapeople_set.all()], + 'resources': [r.resource.dict() for r in person.resourcespeople_set.all()], + 'ranges': [r.range.dict() for r in person.rangespeople_set.all()], + 'fields': [r.field.name for r in person.fieldspeople_set.all()], + 'methods': [r.method.name for r in person.methodspeople_set.all()], + 'scales': [r.scale.name for r in person.scalespeople_set.all()], + 'taxa': [r.taxon.name for r in person.taxapeople_set.all()], } return JsonResponse(return_data)