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

36
urlpatterns += i18n_patterns('',
37 38
    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'),
39
)