Merge branch 'master' into test
[auf_savoirs_en_partage_django.git] / auf_savoirs_en_partage / urls.py
1 # -*- encoding: utf-8 -*-
2
3 from django.conf import settings
4 from django.conf.urls import patterns, include, url
5 from django.conf.urls.static import static
6 from django.contrib import admin
7 from django.views.generic import TemplateView
8
9 from savoirs.rss import \
10 FilChercheurs, FilRessources, FilActualites, \
11 FilAppels, FilEvenements, FilSites, FilMessages
12
13 from chercheurs.forms import ReactiverForm
14
15 from sitemaps import sitemaps
16
17 from views import RobotsTxtView
18
19
20 admin.autodiscover()
21
22 handler500 = "views.page_500"
23 handler404 = "views.page_404"
24
25 # Les URLs suivantes peuvent être préfixées de la discipline et/ou la
26 # région. Nous les regroupons donc dans un module qu'on incluera plus bas.
27 sep_patterns = patterns(
28 '',
29
30 # accueil
31 url(r'^$', 'savoirs.views.index', name='accueil'),
32
33 # recherche
34 url(r'^recherche/$', 'savoirs.views.recherche'),
35 )
36
37 urlpatterns = sep_patterns + patterns(
38 '',
39
40 url(r'^informations/$', 'savoirs.views.informations'),
41
42 # agenda
43 url(r'^agenda/$', 'savoirs.views.evenement_index', name='agenda'),
44 url(r'^agenda/evenements/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.evenement',
45 name='evenement'),
46 url(r'^agenda/evenements/(?P<id>\d+)/$', 'savoirs.views.evenement',
47 name='evenement-canonical'),
48 url(r'^agenda/evenements/moderer/$', 'savoirs.views.evenement_moderation'),
49 url(r'^agenda/evenements/moderer/(.+)/accepter/$',
50 'savoirs.views.evenement_accepter'),
51 url(r'^agenda/evenements/moderer/(.+)/refuser/$',
52 'savoirs.views.evenement_refuser'),
53 url(r'^agenda/evenements/utilisation/$', 'savoirs.views.page_statique',
54 kwargs={'id': 'conditions-agenda'}, name='conditions-agenda'),
55 url(r'^agenda/evenements/creer/$', 'savoirs.views.evenement_ajout',
56 name='evenement-ajout'),
57 url(r'^agenda/evenements/creer/options_fuseau_horaire/$',
58 'savoirs.views.options_fuseau_horaire'),
59
60 # sous-menu droite
61 url(r'^a-propos/$', 'savoirs.views.page_statique',
62 kwargs={'id': 'a-propos'}, name='a-propos'),
63 url(r'^aide/$', 'savoirs.views.page_statique',
64 kwargs={'id': 'aide'}, name='aide'),
65 url(r'^domaines-de-recherche/$', 'savoirs.views.page_statique',
66 kwargs={'id': 'domaines-de-recherche'}, name='domaines-de-recherche'),
67 url(r'^legal/$', 'savoirs.views.page_statique',
68 kwargs={'id': 'legal'}, name='legal'),
69 url(r'^nous-contacter/$', 'savoirs.views.page_statique',
70 kwargs={'id': 'contact'}, name='contact'),
71
72 # ressources
73 url(r'^ressources/$', 'savoirs.views.ressource_index', name='ressources'),
74 url(r'^ressources/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.ressource_retrieve',
75 name='ressource'),
76 url(r'^ressources/(?P<id>\d+)/$', 'savoirs.views.ressource_retrieve',
77 name='ressource-canonical'),
78
79 # actualités
80 url(r'^actualites/$', 'savoirs.views.actualite_index', name='actualites'),
81 url(r'^actualites/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'savoirs.views.actualite',
82 name='actualite'),
83 url(r'^actualites/(?P<id>\d+)/$', 'savoirs.views.actualite',
84 name='actualite-canonical'),
85 url(r'^appels/$', 'savoirs.views.actualite_index',
86 kwargs={'type': 'appels'}, name='appels'),
87
88 # sites
89 url(r'^sites/$', 'sitotheque.views.index', name='sites'),
90 url(r'^sites/(?P<id>\d+)/$', 'sitotheque.views.retrieve', name='site'),
91 url(r'^sites/google.xml$', 'sitotheque.views.config_google'),
92
93 # sites AUF
94 url(r'^sites-auf/$', 'savoirs.views.sites_auf', name='sites-auf'),
95
96 # chercheurs
97 url(r'^chercheurs/$', 'chercheurs.views.index', name='chercheurs'),
98 url(r'^chercheurs/(?P<id>\d+)/(?P<slug>[\w\d\-\_\.]+)$', 'chercheurs.views.retrieve',
99 name='chercheur'),
100 url(r'^chercheurs/(?P<id>\d+)/$', 'chercheurs.views.retrieve',
101 name='chercheur-canonical'),
102 url(r'^chercheurs/inscription/$', 'chercheurs.views.inscription',
103 name='inscription'),
104 url(r'^chercheurs/inscription_faite/$',
105 TemplateView.as_view(
106 template_name='chercheurs/inscription_faite.html'
107 ),
108 name='chercheurs-inscription-faite'),
109 url(r'^chercheurs/activation/(?P<id_base36>.*)/(?P<token>.*)/$',
110 'chercheurs.views.activation',
111 name='chercheurs-activation'),
112 url(r'^chercheurs/desinscription/$', 'chercheurs.views.desinscription'),
113 url(r'^chercheurs/perso/$', 'chercheurs.views.perso'),
114 url(r'^chercheurs/edit/$', 'chercheurs.views.edit'),
115 url(r'^chercheurs/conversion$', 'savoirs.views.page_statique',
116 kwargs={'id': 'table-de-passage'}, name='conversion'),
117
118 url(r'^chercheurs/connexion/$', 'chercheurs.views.login',
119 kwargs={'template_name': 'chercheurs/login.html'},
120 name='chercheurs-login'),
121 url(r'^chercheurs/deconnexion/$', 'django.contrib.auth.views.logout',
122 kwargs={'template_name': 'chercheurs/logged_out.html'},
123 name='chercheurs-logout'),
124
125 url(r'^chercheurs/changement-mdp/$', 'chercheurs.views.password_change',
126 kwargs={
127 'template_name': 'chercheurs/password_change_form.html',
128 'post_change_redirect': '/chercheurs/changement-mdp-fini/'
129 },
130 name='chercheurs-password-change'),
131 url(r'^chercheurs/changement-mdp-fini/$',
132 'django.contrib.auth.views.password_change_done',
133 kwargs={'template_name': 'chercheurs/password_change_done.html'},
134 name='chercheurs-password-change-done'),
135
136 # Oublié mot de passe
137 url(r'^chercheurs/oubli-mdp/$', 'django.contrib.auth.views.password_reset',
138 kwargs={
139 'template_name': 'chercheurs/password_reset_form.html',
140 'email_template_name': 'chercheurs/password_reset_email.txt',
141 'post_reset_redirect': '/chercheurs/oubli-mdp-envoye/'
142 },
143 name='chercheurs-password-reset'),
144 url(r'^chercheurs/oubli-mdp-envoye/$',
145 'django.contrib.auth.views.password_reset_done',
146 kwargs={'template_name': 'chercheurs/password_reset_done.html'},
147 name='chercheurs-password-reset-done'),
148 url(r'^chercheurs/oubli-mdp-retour/(?P<uidb36>.*)/(?P<token>.*)/$',
149 'django.contrib.auth.views.password_reset_confirm',
150 kwargs={'template_name': 'chercheurs/password_reset_confirm.html'},
151 name='chercheurs-password-reset-confirm'),
152 url(r'^chercheurs/oubli-mdp-fini/$',
153 'django.contrib.auth.views.password_reset_complete',
154 kwargs={'template_name': 'chercheurs/password_reset_complete.html'}),
155
156 # Réactiver fiche
157 url(r'^chercheurs/reactiver/$', 'django.contrib.auth.views.password_reset',
158 kwargs={
159 'template_name': 'chercheurs/reactiver_form.html',
160 'email_template_name': 'chercheurs/reactiver_email.txt',
161 'post_reset_redirect': '/chercheurs/reactiver-envoye/'
162 },
163 name='chercheurs-reactiver'),
164 url(r'^chercheurs/reactiver-envoye/$',
165 'django.contrib.auth.views.password_reset_done',
166 kwargs={'template_name': 'chercheurs/reactiver_done.html'},
167 name='chercheurs-reactiver-done'),
168 url(r'^chercheurs/reactiver-retour/(?P<uidb36>.*)/(?P<token>.*)/$',
169 'django.contrib.auth.views.password_reset_confirm',
170 kwargs={'template_name': 'chercheurs/reactiver_confirm.html',
171 'set_password_form': ReactiverForm},
172 name='chercheurs-reactiver-confirm'),
173 url(r'^chercheurs/reactiver-fini/$',
174 'django.contrib.auth.views.password_reset_complete',
175 kwargs={'template_name': 'chercheurs/reactiver_complete.html'}),
176
177 # auto complete
178 url(r'^etablissements/autocomplete/$',
179 'chercheurs.views.etablissements_autocomplete'),
180 url(r'^etablissements/autocomplete/(?P<pays>.*)/$',
181 'chercheurs.views.etablissements_autocomplete'),
182
183 # API chercheurs
184 url(r'^api/chercheurs/(?P<chercheur_id>\d+)/$', 'chercheurs.api.api'),
185 url(r'^api/chercheurs/pays/(?P<pays>.*)/$', 'chercheurs.api.api'),
186 url(r'^api/chercheurs/region/(?P<region>.*)/$', 'chercheurs.api.api'),
187 url(r'^api/chercheurs/recherche', 'chercheurs.api.recherche'),
188
189
190 # groupes
191 url(r'^groupes/$', 'chercheurs.views.groupe_index'),
192 url(r'^groupes/(?P<id>\d+)/$', 'chercheurs.views.groupe_retrieve',
193 name='groupe_retrieve'),
194 url(r'^groupes/(?P<id>\d+)/adhesion/$', 'chercheurs.views.groupe_adhesion',
195 name='groupe_adhesion'),
196 url(r'^groupes/(?P<id>\d+)/membres/$', 'chercheurs.views.groupe_membres',
197 name='groupe_membres'),
198 url(r'^groupes/(?P<id>\d+)/messages/$', 'chercheurs.views.groupe_messages',
199 name='groupe_messages'),
200
201 # section par discipline et/ou région
202 url(r'^discipline/(?P<discipline>\d+)/', include(sep_patterns)),
203 url(r'^region/(?P<region>\d+)/', include(sep_patterns)),
204 url(r'^discipline/(?P<discipline>\d+)/region/(?P<region>\d+)/',
205 include(sep_patterns)),
206
207 # traduction disponible dans le frontend sans permissons
208 url(r'^jsi18n/$', admin.site.i18n_javascript),
209
210 # Rappels
211 url(r'^admin/rappels/$', 'rappels.views.admin_rappels',
212 name='admin-rappels'),
213
214 # Admin
215 url(r'^admin_tools/', include('admin_tools.urls')),
216 url(r'^admin/', include(admin.site.urls)),
217 url(r'^admin/confirmation/(.*)', 'savoirs.admin_views.confirmation'),
218 url(r'^admin/assigner_pays', 'savoirs.admin_views.assigner_pays'),
219 url(r'^admin/assigner_thematiques',
220 'savoirs.admin_views.assigner_thematiques'),
221 url(r'^admin/assigner_categorie',
222 'savoirs.admin_views.assigner_categorie'),
223 url(r'^admin/assigner_cgstatut',
224 'chercheurs.admin_views.assigner_cgstatut'),
225 url(r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/assigner_regions',
226 'savoirs.admin_views.assigner_regions',
227 name='assigner_regions'),
228 url(r'^admin/(?P<app_name>[^/]*)/(?P<model_name>[^/]*)/'
229 r'assigner_disciplines',
230 'savoirs.admin_views.assigner_disciplines',
231 name='assigner_disciplines'),
232 url(r'^admin/chercheurs/chercheur/export',
233 'chercheurs.admin_views.export'),
234 url(r'^admin/', include(admin.site.urls)),
235
236 # stats
237 url(r'^stats/$', 'savoirs.admin_views.stats', name='stats'),
238
239
240 # rss
241 url(r'^rss/chercheurs/$', FilChercheurs(), name='rss_chercheurs'),
242 url(r'^rss/ressources/$', FilRessources(), name='rss_ressources'),
243 url(r'^rss/actualites/$', FilActualites(), name='rss_actualites'),
244 url(r'^rss/appels/$', FilAppels(), name='rss_appels'),
245 url(r'^rss/agenda/$', FilEvenements(), name='rss_agenda'),
246 url(r'^rss/sites/$', FilSites(), name='rss_sites'),
247 url(r'^rss/messages/(?P<groupe_id>\d+)/$', FilMessages(),
248 name='rss_messages'),
249 url(r'^json/get/$', 'savoirs.views.json_get'),
250 url(r'^json/set/$', 'savoirs.views.json_set'),
251
252 # recherches sauvegardées
253 url(r'^recherches/$', 'savoirs.views.recherches', name='recherches'),
254 url(r'^recherches/(?P<type>[^/]*)/sauvegarder/$',
255 'savoirs.views.sauvegarder_recherche',
256 name='sauvegarder_recherche'),
257 url(r'^recherches/(?P<id>\d+)/supprimer/$',
258 'savoirs.views.supprimer_recherche',
259 name='supprimer_recherche'),
260 url(r'^recherches/(?P<id>\d+)/editer/$',
261 'savoirs.views.editer_recherche',
262 name='editer_recherche'),
263 url(r'^recherches/(?P<id>\d+)/activer-alerte/$',
264 'savoirs.views.activer_alerte',
265 name='activer_alerte'),
266 url(r'^recherches/(?P<id>\d+)/desactiver-alerte/$',
267 'savoirs.views.desactiver_alerte',
268 name='desactiver_alerte'),
269
270 # API Interface (FAUN)
271 url(r'^faun/auteurs/(?P<id>\d+)', 'interfaces.views.faun_auteurs',
272 name='faun_auteurs'),
273
274 # Django-selectable
275 (r'^djselectable/', include('selectable.urls')),
276
277 # Robots.txt et Sitemaps
278 (r'^robots\.txt$', RobotsTxtView.as_view()),
279 (r'^sitemap\.xml$', 'django.contrib.sitemaps.views.index', {'sitemaps': sitemaps}),
280 (r'^sitemap-(?P<section>.+)\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}),
281
282 # Plan du site
283 url(r'^plan-du-site/$', TemplateView.as_view(template_name='plan_site.html'), name='plan-site'),
284
285 # Page statique ?
286 url(r'^(?P<id>.*)/$', 'savoirs.views.page_statique'),
287
288 ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)