urls.py 2.28 KB
Newer Older
1
from django.conf.urls import patterns, include, url
2
from django.conf.urls.i18n import i18n_patterns
christophe siraut's avatar
christophe siraut committed
3
from django.contrib.auth.views import login, logout
4 5 6
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView, ListView
from django.views.generic.edit import UpdateView
7 8
from meetingpoll.models import Poll
from meetingpoll.forms import PollForm
9

10
# Enable the admin:
chris's avatar
chris committed
11 12
from django.contrib import admin
admin.autodiscover()
13 14

urlpatterns = patterns('',
15 16 17
    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'),
18
    url(r'^(?P<poll_id>\w{4})/$', 'meetingpoll.views.vote'),
19
    url(r'^(?P<poll_id>\w{5})/$', 'meetingpoll.views.vote'),
20
    url(r'^new/$', 'meetingpoll.views.new', name='new'),
21 22 23 24
    url(r'^(?P<pk>\w+)/edit/$', login_required(UpdateView.as_view(
                                    queryset=Poll.objects.all(),
                                    form_class=PollForm,
                                    success_url='choices/'))),
25 26 27
    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'),
28
    url(r'^(?P<poll_id>\w{5})/vote/$', 'meetingpoll.views.vote', name='vote'),
29
    url(r'^(?P<poll_id>\w+)/csv/$', 'meetingpoll.views.exp_csv'),
30
    url(r'^accounts/profile/$', 'account.views.profile', name='profile'),
Christophe Siraut's avatar
Christophe Siraut committed
31 32
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^i18n/', include('django.conf.urls.i18n')),
33
    url(r'^(?P<poll_id>\w{4})/clear/', 'meetingpoll.userviews.clear_cookie'),
34
    url(r'^(?P<poll_id>\w{5})/clear/', 'meetingpoll.userviews.clear_cookie'),
35 36
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
37
)
christophe siraut's avatar
christophe siraut committed
38

39
urlpatterns += i18n_patterns('',
40 41
    url(r'^nuages/$', TemplateView.as_view(template_name='nuages.html'), name='documentation_translated'),
    url(r'^$', ListView.as_view(queryset=Poll.objects.all(), template_name='index.html'), name='home_translated'),
42
)