Exemplo n.º 1
0
def ajax(request):
	if request.method == "POST":
		volunteer = Volunteer()
		volunteer.first_name = request.POST['first_name']
		volunteer.save()

	volunteer_list = list(Volunteer.objects.all())
	ajax_list = []
	for item in volunteer_list:
		ajax_list.append({
			"first_name": item.first_name,
			"last_name": item.last_name,
			"email": item.email,
			})

	return HttpResponse(dumps(ajax_list), content_type="application/json")