urls.py 2.17 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
from meetingpoll.models import Poll
from meetingpoll.forms import PollForm
6 7

# Uncomment the next two lines to enable the admin:
chris's avatar
chris committed
8 9
from django.contrib import admin
admin.autodiscover()
10

christophe siraut's avatar
christophe siraut committed
11 12 13 14 15 16 17 18 19 20 21

info_dict = {
    'queryset': Poll.objects.all(),
}

poll_dict = {
    #'model' : Poll,
    'form_class' : PollForm,
    'post_save_redirect' : '/'
}

22
urlpatterns = patterns('',
Christophe Siraut's avatar
Christophe Siraut committed
23 24 25
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name='index.html'), name='home'),
26
    url(r'^nuages/$', 'django.views.generic.simple.direct_to_template', {'template': 'nuages.html'}, name='documentation'),
27
    url(r'^languages/$', 'django.views.generic.simple.direct_to_template', {'template': 'languages.html'}, name='languages'),
28
    #url(r'^(?P<lang_id>\w{2})/nuages$', 'meetingpoll.views.translation'),
29 30 31 32 33 34 35
    url(r'^(?P<poll_id>\w{4})/$', 'meetingpoll.views.vote'),
    url(r'^new/$', 'meetingpoll.views.new', name='new'),
    url(r'^(?P<object_id>\w+)/edit/$', 'meetingpoll.views.secure_update_object', dict(poll_dict, post_save_redirect='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+)/csv/$', 'meetingpoll.views.exp_csv'),
36
    url(r'^accounts/profile/$', 'account.views.profile', name='profile'),
Christophe Siraut's avatar
Christophe Siraut committed
37 38
    url(r'^accounts/', include('registration.backends.default.urls')),
    url(r'^i18n/', include('django.conf.urls.i18n')),
39
    url(r'^(?P<poll_id>\w{4})/clear/', 'meetingpoll.userviews.clear_cookie'),
40
)
christophe siraut's avatar
christophe siraut committed
41

42
urlpatterns += i18n_patterns('',
43 44
    url(r'^nuages/$', 'django.views.generic.simple.direct_to_template', {'template': 'nuages.html'}, name='documentation_translated'),
    url(r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name='index.html'), name='home_translated'),
45
)