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

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

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
25
26
27
28
29
30
urlpatterns = patterns('',
    # Example:
    # (r'^nuage/', include('nuage.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    # (r'^admin/', include(admin.site.urls)),
christophe siraut's avatar
christophe siraut committed
31
32

    (r'^$', 'django.views.generic.list_detail.object_list', dict(info_dict, template_name='index.html')),
33
    (r'^nuages$', 'django.views.generic.simple.direct_to_template', {'template': 'nuages.html'}),
christophe siraut's avatar
christophe siraut committed
34
35
36
37
38
39
40
41
42
    (r'^(?P<poll_id>\w{4})/$', 'nuage.sondage.views.vote'),
    (r'^new/$', 'nuage.sondage.views.new'),
    (r'^(?P<object_id>\w+)/edit/$', 'nuage.sondage.views.secure_update_object', dict(poll_dict, post_save_redirect='choices/')),
    #(r'^(?P<poll_id>\w+)/edit/$', 'nuage.sondage.views.edit'),
    (r'^(?P<poll_id>\w+)/edit/choices/$', 'nuage.sondage.views.editchoices'),
    (r'^(?P<poll_id>\w{4})/vote/$', 'nuage.sondage.views.vote'),

    (r'^user/login/$',  login),
    (r'^user/logout/$', logout, {'template_name': 'index.html'}),
43
    (r'^user/register', 'nuage.sondage.userviews.register'),
44
    (r'^user/success$', 'django.views.generic.simple.direct_to_template', {'template': 'registration/success.html'}),
christophe siraut's avatar
christophe siraut committed
45

46
47
    (r'^i18n/', include('django.conf.urls.i18n')),

48
)
christophe siraut's avatar
christophe siraut committed
49
50
51
52
53
54
55
56
57
58
59


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}),
    )