urls.py 1.86 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
22
23
24
urlpatterns = patterns('',
    # Example:
    # (r'^nuage/', include('nuage.foo.urls')),

Christophe Siraut's avatar
Christophe Siraut committed
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    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'),
    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'),
41
)
christophe siraut's avatar
christophe siraut committed
42

Christophe Siraut's avatar
Christophe Siraut committed
43
'''
christophe siraut's avatar
christophe siraut committed
44
45
46
47
48
49
50
51
from django.conf import settings

if settings.DEBUG:
    urlpatterns += patterns('',
        (r'^%s/(?P<path>.*)$' % settings.MEDIA_URL[1:-1],
         'django.views.static.serve',
         {'document_root':  settings.MEDIA_ROOT, 'show_indexes': False}),
    )
Christophe Siraut's avatar
Christophe Siraut committed
52
'''