urls.py 1.13 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
from meetingpoll.models import Poll
from meetingpoll.forms import PollForm

urlpatterns = patterns(
    '',
    url(r'^new/$', 'meetingpoll.views.new', name='new'),
    url(r'^(?P<pk>\w{4,6})/edit/$',
        login_required(UpdateView.as_view(
            queryset=Poll.objects.all(),
            form_class=PollForm,
14 15
            success_url='choices/')),
        name="edit"),
16 17 18
    url(r'^(?P<poll_id>\w{4,6})/$',
        'meetingpoll.views.vote',
        name='meetingpoll'),
19 20 21
    url(r'^(?P<poll_id>\w{4,6})/delete/$',
        'meetingpoll.views.delete',
        name="delete"),
22 23 24 25 26 27 28 29 30 31 32 33 34
    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',
        name='csv'),
    url(r'^(?P<poll_id>\w{4,6})/clear/',
        'meetingpoll.views.clear_cookie',
        name='clearcookie'),
)