Merge branch 'master' of ssh://git.auf/auf_savoirs_en_partage_django
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / urls.py
1 # -*- encoding: utf-8 -*-
2
3 from django.conf.urls.defaults import patterns, include, handler500, handler404, url
4 from django.conf import settings
5 from django.contrib import admin
6 from savoirs.rss import FilActualite, FilEvenement
7
8 admin.autodiscover()
9
10 handler500 = "views.page_500"
11 handler404 = "views.page_404"
12
13 site_feeds = {'actualites': FilActualite,
14 'agenda': FilEvenement }
15
16
17 # Les URLs suivantes peuvent être préfixées de la discipline et/ou la
18 # région. Nous les regroupons donc dans un module qu'on incluera plus bas.
19 sep_patterns = patterns(
20 '',
21
22 # accueil
23 (r'^$', 'savoirs.views.index'),
24
25 # recherche
26 (r'^recherche/$', 'savoirs.views.recherche'),
27 )
28
29 urlpatterns = sep_patterns + patterns(
30 '',
31
32 (r'^informations/$', 'savoirs.views.informations'),
33
34 # agenda
35 (r'^agenda/$', 'savoirs.views.evenement_index'),
36 (r'^agenda/evenements/(?P<id>\d+)/$', 'savoirs.views.evenement'),
37 (r'^agenda/evenements/moderer/$', 'savoirs.views.evenement_moderation'),
38 (r'^agenda/evenements/moderer/(.+)/accepter/$', 'savoirs.views.evenement_accepter'),
39 (r'^agenda/evenements/moderer/(.+)/refuser/$', 'savoirs.views.evenement_refuser'),
40 (r'^agenda/evenements/utilisation/$', 'savoirs.views.evenement_utilisation'),
41 (r'^agenda/evenements/creer/$', 'savoirs.views.evenement_ajout'),
42 (r'^agenda/evenements/creer/options_fuseau_horaire/$', 'savoirs.views.options_fuseau_horaire'),
43
44 # sous-menu droite
45 (r'^a-propos/$', 'savoirs.views.a_propos'),
46 (r'^legal/$', 'savoirs.views.legal'),
47 (r'^nous-contacter/$', 'savoirs.views.nous_contacter'),
48
49 # ressources
50 (r'^ressources/$', 'savoirs.views.ressource_index'),
51 (r'^ressources/(?P<id>\d+)/$', 'savoirs.views.ressource_retrieve'),
52
53 # actualités
54 (r'^actualites/$', 'savoirs.views.actualite_index'),
55 (r'^actualites/(?P<id>\d+)/$', 'savoirs.views.actualite'),
56
57 # sites
58 (r'^sites/$', 'sitotheque.views.index'),
59 (r'^sites/(?P<id>\d+)/$', 'sitotheque.views.retrieve'),
60
61 # sites AUF
62 (r'^sites-auf/$', 'savoirs.views.sites_auf'),
63
64 # chercheurs
65 (r'^chercheurs/$', 'chercheurs.views.index'),
66 (r'^chercheurs/(?P<id>\d+)/$', 'chercheurs.views.retrieve'),
67 (r'^chercheurs/inscription/$', 'chercheurs.views.inscription'),
68 (r'^chercheurs/inscription_faite/$', 'django.views.generic.simple.direct_to_template', dict(
69 template='chercheurs/inscription_faite.html'
70 ), 'chercheurs-inscription-faite'),
71 (r'^chercheurs/activation/(?P<id_base36>.*)/(?P<token>.*)/$', 'chercheurs.views.activation', {}, 'chercheurs-activation'),
72 (r'^chercheurs/desinscription/$', 'chercheurs.views.desinscription'),
73 (r'^chercheurs/perso/$', 'chercheurs.views.perso'),
74 (r'^chercheurs/edit/$', 'chercheurs.views.edit'),
75 (r'^chercheurs/conversion$', 'chercheurs.views.conversion'),
76 (r'^chercheurs/connexion/$', 'django.contrib.auth.views.login', dict(
77 template_name='chercheurs/login.html'
78 ), 'chercheurs-login'),
79 (r'^chercheurs/deconnexion/$', 'django.contrib.auth.views.logout', dict(
80 template_name='chercheurs/logged_out.html'
81 ), 'chercheurs-logout'),
82 (r'^chercheurs/changement-mdp/$', 'django.contrib.auth.views.password_change', dict(
83 template_name='chercheurs/password_change_form.html',
84 post_change_redirect='/chercheurs/changement-mdp-fini/'
85 ), 'chercheurs-password-change'),
86 (r'^chercheurs/changement-mdp-fini/$', 'django.contrib.auth.views.password_change_done', dict(
87 template_name='chercheurs/password_change_done.html'
88 ), 'chercheurs-password-change-done'),
89 (r'^chercheurs/oubli-mdp/$', 'django.contrib.auth.views.password_reset', dict(
90 template_name='chercheurs/password_reset_form.html',
91 email_template_name='chercheurs/password_reset_email.txt',
92 post_reset_redirect='/chercheurs/oubli-mdp-envoye/'
93 ), 'chercheurs-password-reset'),
94 (r'^chercheurs/oubli-mdp-envoye/$', 'django.contrib.auth.views.password_reset_done', dict(
95 template_name='chercheurs/password_reset_done.html'
96 ), 'chercheurs-password-reset-done'),
97 (r'^chercheurs/oubli-mdp-retour/(?P<uidb36>.*)/(?P<token>.*)/$', 'django.contrib.auth.views.password_reset_confirm', dict(
98 template_name='chercheurs/password_reset_confirm.html'
99 ), 'chercheurs-password-reset-confirm'),
100 (r'^chercheurs/oubli-mdp-fini/$', 'django.contrib.auth.views.password_reset_complete', dict(
101 template_name='chercheurs/password_reset_complete.html'
102 )),
103 (r'^etablissements/autocomplete/$', 'chercheurs.views.etablissements_autocomplete'),
104 (r'^etablissements/autocomplete/(?P<pays>.*)/$', 'chercheurs.views.etablissements_autocomplete'),
105
106 # section par discipline et/ou région
107 (r'^discipline/(?P<discipline>\d+)/', include(sep_patterns)),
108 (r'^region/(?P<region>\d+)/', include(sep_patterns)),
109 (r'^discipline/(?P<discipline>\d+)/region/(?P<region>\d+)/', include(sep_patterns)),
110
111 # traduction disponible dans le frontend sans permissons
112 url(r'^jsi18n/$', admin.site.i18n_javascript,),
113
114 url(r'^admin_tools/', include('admin_tools.urls')),
115 (r'^admin/', include(admin.site.urls)),
116 (r'^admin/confirmation/(.*)', 'savoirs.admin_views.confirmation'),
117 (r'^admin/assigner_pays', 'savoirs.admin_views.assigner_pays'),
118 (r'^admin/assigner_thematiques', 'savoirs.admin_views.assigner_thematiques'),
119 (r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/assigner_regions', 'savoirs.admin_views.assigner_regions', {}, 'assigner_regions'),
120 (r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/assigner_disciplines', 'savoirs.admin_views.assigner_disciplines', {}, 'assigner_disciplines'),
121 (r'^admin/(.*)', admin.site.root),
122
123
124 # rss
125 (r'^rss/(.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict':site_feeds}),
126 (r'^json/get/$', 'savoirs.views.json_get'),
127 (r'^json/set/$', 'savoirs.views.json_set'),
128
129 )
130
131 if settings.DEBUG:
132 urlpatterns += patterns('',
133 (r'^media/(?P<path>.*)$', 'django.views.static.serve',
134 {'document_root': settings.MEDIA_ROOT}),
135 )