urls.py 2.08 KB
Newer Older
1 2
from django.conf.urls.defaults import patterns, include, url
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 19
    url(r'^(?P<poll_id>\w{4})/$', 'meetingpoll.views.vote'),
    url(r'^new/$', 'meetingpoll.views.new', name='new'),
20 21 22 23
    url(r'^(?P<pk>\w+)/edit/$', login_required(UpdateView.as_view(
                                    queryset=Poll.objects.all(),
                                    form_class=PollForm,
                                    success_url='choices/'))),
24 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'),
    url(r'^(?P<poll_id>\w+)/csv/$', 'meetingpoll.views.exp_csv'),
28
    url(r'^accounts/profile/$', 'account.views.profile', name='profile'),
Christophe Siraut's avatar
Christophe Siraut committed
29 30
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^i18n/', include('django.conf.urls.i18n')),
31
    url(r'^(?P<poll_id>\w{4})/clear/', 'meetingpoll.userviews.clear_cookie'),
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
)