from django.core import serializers @login_required def ajax_get_data(request): json_data = serializers.serialize("json", MyModel.objects.all()) return HttpResponse(json_data,content_type="application/json")
objectQuerySet = ConventionCard.objects.filter(ownerUser = user) data = serializers.serialize('json', list(objectQuerySet), fields=('fileName','id'))