2016-11-11T16:55:21
Django QuerySet to JSON
import json
polls = Poll.objects.all()
# Convert our QuerySet into a list so polls can be serialized
print json.dumps(list(p), indent=2)
JsonResponse({'polls': list(polls)})
Source: http://stackoverflow.com/questions/7650448/django-serialize-queryset-values-into-json