Commit 506d9336 authored by chris's avatar chris

Starting csv export implementation.

parent 40a9ab93
# Here are the views for sondage
import datetime
import csv
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.core.urlresolvers import reverse
......@@ -278,4 +279,11 @@ def vote(request, poll_id):
current_site = settings.SITE +
return render_to_response('sondage/poll_detail.html', {'object': poll, 'form': form, 'vforms':vforms, 'error_message':error_message, 'has_voted': has_voted, 'current_site': current_site}, context_instance=RequestContext(request))
def exp_csv(request, poll_id):
poll = get_object_or_404(Poll.objects.all(),id=poll_id)
choices = Choice.objects.filter(poll=poll)
bulletins = Bulletin.objects.filter(poll=poll)
#writer = csv.writer(csv_file, quotechar='"', quoting=csv.QUOTE_ALL)
#for c in choices:
return HttpResponse(bulletins)
......@@ -33,6 +33,7 @@ urlpatterns = patterns('',
(r'^(?P<poll_id>\w+)/delete/$', 'sondage.views.delete'),
(r'^(?P<poll_id>\w+)/edit/choices/$', 'sondage.views.editchoices'),
(r'^(?P<poll_id>\w{4})/vote/$', ''),
(r'^(?P<poll_id>\w+)/csv/$', 'sondage.views.exp_csv'),
(r'^user/', include('account.urls')),
#(r'^user/login/$', login),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment