urls.py 1.61 KB
Newer Older
1
from django.conf.urls.defaults import *
christophe siraut's avatar
christophe siraut committed
2
from django.contrib.auth.views import login, logout
chris's avatar
chris committed
3 4
from sondage.models import Poll
from sondage.forms import PollForm
5 6

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

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

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

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

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