Get fields correctly

This commit is contained in:
PCoder 2021-09-02 07:26:13 +05:30
parent 77fa49ac2b
commit 60cbf42997

View file

@ -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)