In order to allow non-dict objects to be serialized set the safe parameter to False.
2021. 1. 16. 22:46ㆍ파이썬/Django
def getData(reqeust) :
data = []
tasks = serializers.serialize('json', Gantt.objects.filter(work=2))
data.append({ 'tasks' : tasks })
print(data)
return JsonResponse(data)
return JsonResponse(data, safe=False)를 하면 해결됨
'파이썬 > Django' 카테고리의 다른 글
json post 방식 처리 (0) | 2021.01.17 |
---|---|
Forbidden (CSRF token missing or incorrect.): (0) | 2021.01.17 |
Django custom template tag filter 추가 (0) | 2021.01.16 |
템플릿 forloop.counter 사용 (0) | 2021.01.16 |
'with' expected at least one variable assignment (0) | 2021.01.16 |