Commit 7050cb1d authored by Christophe Siraut's avatar Christophe Siraut

Cleanup.

parent 2398b719
......@@ -35,3 +35,7 @@ def profile(request):
form = UserProfileForm(instance=request.user.userprofile)
return render(request, "form.html", {'form': form})
def clear_cookie(request, poll_id):
request.session.clear()
return HttpResponseRedirect(reverse('vote', args=(poll_id,)))
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
def register(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
new_user = form.save()
return HttpResponseRedirect("/user/success")
else:
form = UserCreationForm()
return render_to_response("registration/register.html", {
'form': form,
}, context_instance=RequestContext(request))
def clear_cookie(request, poll_id):
request.session.clear()
return HttpResponseRedirect(reverse('vote', args=(poll_id,)))
......@@ -15,23 +15,20 @@ urlpatterns = patterns('',
url(r'^$', ListView.as_view(queryset=Poll.objects.all(), template_name='index.html'), name='home'),
url(r'^nuages/$', TemplateView.as_view(template_name='nuages.html'), name='documentation'),
url(r'^languages/$', TemplateView.as_view(template_name='languages.html'), name='languages'),
url(r'^(?P<poll_id>\w{4})/$', 'meetingpoll.views.vote'),
url(r'^(?P<poll_id>\w{5})/$', 'meetingpoll.views.vote'),
url(r'^new/$', 'meetingpoll.views.new', name='new'),
url(r'^(?P<pk>\w+)/edit/$', login_required(UpdateView.as_view(
url(r'^(?P<pk>\w{4,6})/edit/$', login_required(UpdateView.as_view(
queryset=Poll.objects.all(),
form_class=PollForm,
success_url='choices/'))),
url(r'^(?P<poll_id>\w+)/delete/$', 'meetingpoll.views.delete'),
url(r'^(?P<poll_id>\w+)/edit/choices/$', 'meetingpoll.views.editchoices', name='choices'),
url(r'^(?P<poll_id>\w{4})/vote/$', 'meetingpoll.views.vote', name='vote'),
url(r'^(?P<poll_id>\w{5})/vote/$', 'meetingpoll.views.vote', name='vote'),
url(r'^(?P<poll_id>\w+)/csv/$', 'meetingpoll.views.exp_csv'),
url(r'^(?P<poll_id>\w{4,6})/$', 'meetingpoll.views.vote'),
url(r'^(?P<poll_id>\w{4,6})/delete/$', 'meetingpoll.views.delete'),
url(r'^(?P<poll_id>\w{4,6})/edit/choices/$', 'meetingpoll.views.editchoices', name='choices'),
url(r'^(?P<poll_id>\w{4,6})/vote/$', 'meetingpoll.views.vote', name='vote'),
url(r'^(?P<poll_id>\w{4,6})/csv/$', 'meetingpoll.views.exp_csv'),
url(r'^(?P<poll_id>\w{4,6})/clear/', 'account.view.clear_cookie'),
url(r'^accounts/profile/$', 'account.views.profile', name='profile'),
url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^(?P<poll_id>\w{4})/clear/', 'meetingpoll.userviews.clear_cookie'),
url(r'^(?P<poll_id>\w{5})/clear/', 'meetingpoll.userviews.clear_cookie'),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
)
......
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